#include<iostream>
using namespace std;
int dp[1010];
int main()
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif)
{
int i,j,k;
dp[1]=1;
for(i=2;i<1001;i++)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
dp[i]=1;
for(j=0;j<i;j++)
if((i-j)%2==0)
dp[i]+=dp[(i-j)/2];
}
scanf("%d",&k);
for(j=1;j<=k;j++)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
scanf("%d",&i);
printf("%d %d\n",j,dp[i]);
}
return 0;
}