시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 36 17 17 65.385%

문제

R은 변의 길이가 정수인 직사각형이다. 직사각형은 단위 정사각형으로 나눌 수 있다.

f(R)은 직사각형의 한 대각선이 지나는 정사각형의 개수라고 정의한다. 변의 길이가 2와 4인 직사각형 R의 f(R) = 4이다.

N이 주어졌을 때, f(R) = N을 만족하는 직사각형의 개수를 구하는 프로그램을 작성하시오. 변의 길이가 a×b인 직사각형과 b×a인 직사각형은 같은 직사각형이다. 

입력

첫째 줄에 자연수 N (0 < N < 106)이 주어진다. 

출력

첫째 줄에 f(R) = N인 R의 개수를 출력한다.

예제 입력 1

4

예제 출력 1

4

힌트

W3sicHJvYmxlbV9pZCI6IjM2MTQiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM4MTVcdWMwYWNcdWFjMDFcdWQ2MTUiLCJkZXNjcmlwdGlvbiI6IjxwPlJcdWM3NDAgXHViY2MwXHVjNzU4IFx1YWUzOFx1Yzc3NFx1YWMwMCBcdWM4MTVcdWMyMThcdWM3NzggXHVjOWMxXHVjMGFjXHVhYzAxXHVkNjE1XHVjNzc0XHViMmU0LiBcdWM5YzFcdWMwYWNcdWFjMDFcdWQ2MTVcdWM3NDAgXHViMmU4XHVjNzA0IFx1YzgxNVx1YzBhY1x1YWMwMVx1ZDYxNVx1YzczY1x1Yjg1YyBcdWIwOThcdWIyMGMgXHVjMjE4IFx1Yzc4OFx1YjJlNC48XC9wPlxyXG5cclxuPHA+ZihSKVx1Yzc0MCBcdWM5YzFcdWMwYWNcdWFjMDFcdWQ2MTVcdWM3NTggXHVkNTVjIFx1YjMwMFx1YWMwMVx1YzEyMFx1Yzc3NCBcdWM5YzBcdWIwOThcdWIyOTQgXHVjODE1XHVjMGFjXHVhYzAxXHVkNjE1XHVjNzU4IFx1YWMxY1x1YzIxOFx1Yjc3Y1x1YWNlMCBcdWM4MTVcdWM3NThcdWQ1NWNcdWIyZTQuIFx1YmNjMFx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