|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|10 초||256 MB||105||21||20||28.571%|
After recent riots in Flatland, the leader has granted permission to purchase real estate at the famous Zero street to everyone. Now, not only the noble polygons are allowed to live there, but pentagons, squares, and even triangles as well (if they can afford a house at Zero street, of course)!
As an employee of the “Integer Estate Agency”, you are in charge of the one side of the street. House numbering starts right after Zero Square. House #1 is right off of the square, House #2 comes right after House #1, House #3 comes after House #2, and so on towards Infinity (where, as rumors say, the family of noble Perfect Circles live). House #k costs exactly k+1 coins. There is no House #0, since that is the square.
A promising customer is willing to spend exactly n coins to purchase a single block of consecutive houses to group together as a condo complex. How many options does he have? For example, if he wishes to spend 5 coins, he may buy houses #1 and #2 (which costs 2+3=5), or he may just buy house #4, so he has two options.
There will be several test cases in the input. Each test case will consist of a single integer n (1≤n≤1,000,000) on its own line, indicating the number of coins a customer is willing to spend. The input will end with a line with a single 0.
For each customer, output the number of ways he can buy consecutive houses spending exactly n coins. Output each number on its own line, with no spaces. Do not print any blank lines between outputs.
1 2 5 0
0 1 2