#include <iostream>
using namespace std;
int main()
{
long long int a,b=0,c=1;
cin>>a;
while(a!=0){
if(a%2==1){
a=(a-1)/2;
b=b+1*c;
c=c*10;
}
else{
a=a/2;
c=c*10;
}
}
cout<<b<<endl;
return 0;
}
#include
using namespace std;
int main()
{
long long int a,b=0,c=1;
cin>>a;
while(a!=0){
if(a%2==1){
a=(a-1)/2;
b=b+1*c;
c=c*10;
}
else{
a=a/2;
c=c*10;
}
}
cout<<b<<endl;
return 0;
}
抱歉喔...原來要連續輸入不用管何時break
我懂了