2800 | 2023-01-25 22:05:09 | Karokan | IntervallumXOR kihívás | cpp11 | Forditási hiba |
#include<iostream>
using namespace std;
int main() {
int t; cin>>t;
while(t--) {
(1<<bits)-1int n; cin>>n;
int res = ((n+1)>>1)&1;
if( (n&1) == 0) res^=n;
cout<<res<<endl;
int bits=32-__builtin_clz(n);
if(n&1) cout<<(n)<<endl;
else cout<<(1<<bits)-1<<endl;
}
return 0;
}
exit status 1
main.cpp: In function 'int main()':
main.cpp:7:21: error: 'bits' was not declared in this scope
7 | (1<<bits)-1int n; cin>>n;
| ^~~~
main.cpp:7:27: error: unable to find numeric literal operator 'operator""int'
7 | (1<<bits)-1int n; cin>>n;
| ^~~~
main.cpp:7:27: note: use '-fext-numeric-literals' to enable more built-in suffixes
main.cpp:7:40: error: 'n' was not declared in this scope
7 | (1<<bits)-1int n; cin>>n;
| ^
Exited with error status 1