結果
問題 | No.1298 OR XOR |
ユーザー |
![]() |
提出日時 | 2020-12-04 09:21:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 676 bytes |
コンパイル時間 | 2,096 ms |
コンパイル使用メモリ | 191,344 KB |
最終ジャッジ日時 | 2025-01-16 15:40:07 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:30: warning: ‘b’ may be used uninitialized [-Wmaybe-uninitialized] 26 | cout << a << ' ' << b << ' ' << c << endl; | ^~~ main.cpp:13:12: note: ‘b’ was declared here 13 | int a, b, c; | ^ main.cpp:26:37: warning: ‘c’ may be used uninitialized [-Wmaybe-uninitialized] 26 | cout << a << ' ' << b << ' ' << c << endl; | ^ main.cpp:13:15: note: ‘c’ was declared here 13 | int a, b, c; | ^
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i = 0; i < (n); ++i)#define srep(i,s,t) for (int i = s; i < t; ++i)#define drep(i,n) for(int i = (n)-1; i >= 0; --i)using namespace std;typedef long long int ll;typedef pair<int,int> P;#define yn {puts("YES");}else{puts("NO");}#define MAX_N 200005int main() {int n; cin >> n;int a, b, c;if(__builtin_popcount(n) == 1){a = -1; b = -1; c = -1;}else{a = n;rep(i,31){if((n&(1<<i))!=0){b = 1 << i;c = n - b;break;}}}cout << a << ' ' << b << ' ' << c << endl;return 0;}