using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int x;
cin >> x;
for (int i = 31; i >= 0; i--) {
cout << ((x >> i) & 1);
}
cout << "\n";
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
int x;
cin >> x;
cout << (-1 & 1) << endl; -1 & 1 == 1; -1 >> 2 == -1; 1 >> 2 == 0;
cout << ( x >> 6) << endl;
cout << ((x >> 6) & 1);
cout << "\n";
}
-------------------11 / 2 == 6 就是利用了这个规则
关于&计算 123456 & 1 是将123456转为2进制 然后最后一位与 1 进行 &运算
可以判断奇偶
#include <bits/stdc++.h>
using namespace std;
----------------------------------------------
int main() {
int T;
int x,y;
while(cin >> x >> y){
cout << (11 << 2) << endl;
cout << (-3 & 1) << endl;
cout << ( x >> y) << endl;
cout << ((x >> y) & 1);
cout << "\n";
}
}
*/
-22 0
-22
0
-22 1
-11
1
-22 2
-6
0
-22 3
-3
1
-22 4
-2
0
-22 5
-1
1
22 0
22
0
22 1
11
1
22 2
5
1
22 3
2
0
22 4
1
1
22 5
0
0
实验数据