문제

https://www.acmicpc.net/problem/2667

입력

출력

분석

접근 방법