Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
12217 徐一喆 正整数N转换成一个二进制 C++ Accepted 2 MS 752 KB 251 2021-05-20 12:21:17

Tests(5/5):


Code:

#include<bits/stdc++.h> using namespace std; int n; string r=""; int main(){ cin>>n; while(n!=0){ r=char(n%2+'0')+r; n=n/2; } if(r==""){ cout<<0; }else{ cout<<r; } return 0; }