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

Tests(20/20):


Code:

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