题解 | #二进制数#
二进制数
https://www.nowcoder.com/practice/103dd589fed14457a673c613d8de3841
#include <cstdio> #include <iostream> #include <vector> using namespace std; int main(){ unsigned int T; while(scanf("%d",&T)!=EOF){ vector <int> binary; while(T!=0){ binary.push_back(T%2); T/=2; } for(int i=binary.size()-1;i>=0;i--){ printf("%d",binary[i]); } printf("\n"); } return 0; }