#include <iostream> #include<vector> using namespace std; int main() { unsigned int x = 0; //别丢int while (scanf("%d", &x) != EOF) { vector<int> binary; while (x != 0) { binary.push_back(x % 2); x /= 2; } vector<int>::reverse_iterator it;//反向迭代器 for (it = binary.rbegin(); it != binary.rend(); it++) { //rbegin()与rend()获取反向之后的首尾 printf("%d", *it); } printf("\n"); } }