传送门:http://ac.jobdu.com/problem.php?pid=1473
思路:按照求二进制数的原理进行模拟
AC代码:
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<sstream>
using namespace std;
const int maxn=1000;
int num[maxn];
int main(void)
{
typedef unsigned int LL;
LL a,b,c;
LL s[1000];
int n;
int i,j,k;
while(cin>>n)
{
for(i=0;i<n;i++)
cin>>s[i];
for(i=0;i<n;i++)
{
int index=0;
a=s[i];
if(a==0)
{cout<<0<<endl;continue;}
while(a!=0)
{
num[index++]=a%2;
a/=2;
}
for(j=index-1;j>=0;j--)
cout<<num[j];
cout<<endl;
}
}
}