Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
111229 叶城俊 十进制转二进制 C++ Accepted 1 MS 276 KB 263 2025-03-01 11:05:17

Tests(20/20):


Code:

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