Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
69659 祝家懿 十进制转二进制 C++ Accepted 1 MS 272 KB 272 2024-04-06 11:29:20

Tests(20/20):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; if(a==0){ cout<<'0'; return 0; } int x[32]={0}; int cnt=0; while (a!=0){ x[cnt]=a%2; a/=2; cnt++; } for(int i=cnt-1;i>=0;i--){ cout<<x[i]; } return 0; }