想看題目請點我
#include<iostream>
using namespace std;
int main() {
int x;
while(cin >> x){
char temp[255] ;
for(int i = 0 ; x > 0; i++ )
{
if((x%2)==1)
{
temp[i] = '1' ;
}
else
{
temp[i] = '0' ;
}
x /= 2 ;
if(x==0)
{
for(int j = i ; j >=0 ; j--)
{
cout << temp[j] ;
}
cout << endl ;
}
}
}
return 0;
}