Skip to content

Commit b952925

Browse files
committed
Create 2074C-XORandTriangle.cpp
1 parent 2d08e85 commit b952925

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

2074C-XORandTriangle.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <cstdio>
2+
3+
int main() {
4+
5+
long t; scanf("%ld", &t);
6+
while(t--){
7+
long x; scanf("%ld", &x);
8+
long y = (x & -x) | (~x & -~x);
9+
printf("%ld\n", (y < x ? y : -1));
10+
}
11+
}

0 commit comments

Comments
 (0)