Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
111246 | 程余天皓 | 十进制转二进制 | C++ | Accepted | 1 MS | 272 KB | 269 | 2025-03-01 11:10:18 |
#include<bits/stdc++.h> using namespace std; int x; int a[32]; int main() { int n=0; cin>>x; if(x==0){ cout<<"0"; return 0; } while(x!=0){ int y=x%2; a[n]=y; n++; x/=2; } for(int i=n-1;i>=0;i--){ cout<<a[i]; } return 0; }