Sums of Distinct Natural Numbers
InterviewTime limit7sMemory limit128 MB
Count the partitions of each given N into distinct positive integers, including N itself, modulo 100999.
- Level
Medium4 of 10
- Topics
- Dynamic programming, Combinatorics
- Solved
- No attempts yet
Problem
Count how many ways a positive integer () can be written as a sum of distinct natural numbers.
One way obeys all of the following.
- Every natural number in the sum is different. No number may appear twice.
- Two sums that differ only in the order of the terms count as one way.
- The single-term sum itself counts as one way.
Given , write a program that counts the ways.
Input
The first line has the number of test cases (). Each of the next lines has one .
Output
For each test case, print the number of ways to write as a sum of distinct natural numbers modulo , one per line, in input order.