#include<iostream> #include<stdlib.h> #include<string> using namespace std; void zhuanghua(int x,int y){ string str=""; int a,b,c,d; a=b=c=d=0; a=x; b=y; char ch; while(a){ c=a/b; d=a%b; ch=d+'0'; str=str+ch; a=c; } for(int i=0;str[i]!='\0';++i){ cout<<str[str.length()-1-i]; } } void main(){ int n; while(cin>>n){ zhuanghua(n,2); cout<<endl; } }
杭电ACM 第2051题
最新推荐文章于 2021-04-18 23:14:19 发布