코드: https://pastebin.com/SCtj20S8

https://www.acmicpc.net/problem/25418
예제 2번까지는 맞게 나오는데 3번에서 무한루프가 됩니다.
어디가 문제일까요?

- dc official App