ICPC Square
시간 제한1초메모리 제한2048 MB
N, D, 시작 층 S가 주어질 때 x에서 x의 배수 y 중 y-x<=D인 층으로 이동하며 도달할 수 있는 가장 높은 층을 구한다.
문제
ICPC Square is a hotel provided by the ICPC Committee for the accommodation of the participants. It consists of floors (numbered from to ). This hotel has a very unique elevator. If a person is currently at floor , by riding the elevator once, they can go to floor if and only if is a multiple of and .
You are currently at floor . You want to go to the highest possible floor by riding the elevator zero or more times. Determine the highest floor you can reach.
입력
A single line consisting of three integers (; ; ).
출력
Output a single integer representing the highest floor you can reach by riding the elevator zero or more times.