Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
108122 | 石晋骁 | 十进制转二进制 | C++ | Accepted | 1 MS | 268 KB | 301 | 2025-01-19 14:35:55 |
#include<bits/stdc++.h> using namespace std; int y[100]; int cum = 0; int main(){ int a; cin >> a; if(a == 0){ cout << "0"; return 0; } while(a != 0){ int yu = a%2; y[cum] = yu; cum++; a = a/2; } for(int i = cum-1;i >= 0;i--){ cout << y[i]; } return 0; }