Alice and candies
Practice
3.7 (52 votes)
Basic programming
Number theory
Basic number theory 1
Math
Number theory
Problem
88% Success 15634 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Alice loves candies, so she went into a candy shop. Now the shopkeeper sells candies in packets and all packets contain an odd number of candies (1, 3, 5, 7.....). Alice wants exactly \(N\) candies but she also loves patterns so she decided to buy candies only if the number of candies in the packets is consecutive and distinct (means she cannot buy the same candy packet more than once) and the sum of all the candies in those packets is exactly \(N\).

Alice has an infinite amount of money and the shopkeeper also has infinite amount candy packets, so Alice wonders how many different sets of candy packets she can buy.

Find the number of different sets of candy packets that Alice can buy.

Input format

The first and the only line contains a single integer \(N\ (1 \le N \le 1000000000)\).

Output format

Print a single integer denoting the number of different sets of candy packets Alice can buy.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
24 votes
Tags:
AlgorithmsApprovedEasyOpen
Points:30
57 votes
Tags:
ApprovedCombinatoricsEasyException handlingMathNumber TheoryOpenProbabilityStatistics
Points:30
262 votes
Tags:
ApprovedEasyMathNumber TheoryReady