You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
int main() {
|
|
int x = 15;
|
|
vector<int> path; // 动态数组
|
|
while (x) {
|
|
int a = x % 2;
|
|
path.push_back(a);
|
|
x /= 2;
|
|
}
|
|
for (int i = path.size() - 1; i >= 0; i--)
|
|
cout << path[i];
|
|
return 0;
|
|
} |