시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB36615011955.349%

문제

대부분의 양의 정수는 적어도 2개 이상의 연속된 자연수의 합으로 나타낼 수 있다.

예를 들면 다음과 같다.

6 = 1 + 2 + 3

9 = 5 + 4 = 4 + 3 + 2

하지만, 8은 연속된 자연수 합으로 나타낼 수가 없다.

자연수 N이 주어졌을 때, 이 수를 적어도 2개 이상의 연속된 자연수의 합으로 나타낼 수 있는 경우의 수를 출력하시오.

입력

첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 정수 하나로 이루어져 있다. 이 정수는 문제에서 설명한 N이며, 231보다 작다.

출력

각 테스트 케이스에 대해서 N을 적어도 2개 이상의 연속된 자연수의 합으로 나타내는 경우의 수를 출력한다.

예제 입력 1

7
6
9
8
1800
987654321
987654323
987654325

예제 출력 1

1
2
0
8
17
1
23
W3sicHJvYmxlbV9pZCI6IjI3MzciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM1ZjBcdWMxOGQgXHVkNTY5IiwiZGVzY3JpcHRpb24iOiI8cD5cdWIzMDBcdWJkODBcdWJkODRcdWM3NTggXHVjNTkxXHVjNzU4IFx1YzgxNVx1YzIxOFx1YjI5NCBcdWM4MDFcdWM1YjRcdWIzYzQgMlx1YWMxYyBcdWM3NzRcdWMwYzFcdWM3NTggXHVjNWYwXHVjMThkXHViNDFjIFx1Yzc5MFx1YzVmMFx1YzIxOFx1Yzc1OCBcdWQ1NjlcdWM3M2NcdWI4NWMgXHViMDk4XHVkMGMwXHViMGJjIFx1YzIxOCBcdWM3ODhcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlx1YzYwOFx1Yjk3YyBcdWI0ZTRcdWJhNzQgXHViMmU0XHVjNzRjXHVhY2ZjIFx1YWMxOVx1YjJlNC48XC9wPlxyXG5cclxuPHA+NiA9IDEgKyAyICsgMzxcL3A+XHJcblxyXG48cD45ID0gNSArIDQgPSA0ICsgMyArIDI8XC9wPlxyXG5c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jYW4gYmUgd3JpdHRlbiBhcyBhIHNlcXVlbmNlIG9mIGNvbnNlY3V0aXZlIHBvc2l0aXZlIGludGVnZXJzLjxcL3A+XHJcbiIsImhpbnQiOiIiLCJvcmlnaW5hbCI6IjEiLCJodG1sX3RpdGxlIjoiMCIsInByb2JsZW1fbGFuZ190Y29kZSI6IkVuZ2xpc2gifV0=

출처

ICPC > Regionals > North America > Greater New York Region > 2005 Greater New York Programming Contest I번

  • 문제를 번역한 사람: baekjoon
  • 데이터를 추가한 사람: chansol