A tourist gets lost in the desert with n liters of water. He drinks positive integer units of water each day.
Write a program to calculate how many different ways the tourist can drink up the water.
Input
The first line contains the number of test cases T(T≤10)T(T≤10).
Next TT lines contain the number n(1≤n≤1000000)n(1≤n≤1000000) for each test case.
Output
Output consists of TT lines.
Each line contains the binary number which represents number of different ways to finish up the water specified in the test case.
Sample Input
1
3
Sample Output
100
题意:n升水,每次喝正整数升水,有多少种喝法;
分析:整数划分问题,3分为1+1+1,1+2,2+1,3一共四种
n能分解为2的n-1次方种,转化为二进制,就是一个1,n-1个0.
#include<stdio.h>
#include<string.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int i,n;
scanf("%d",&n);
printf("1");
for(i=1;i<n;i++)
printf("0");
printf("\n");
}
return 0;
}