結果
問題 | No.1298 OR XOR |
ユーザー |
![]() |
提出日時 | 2020-11-27 21:54:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 499 bytes |
コンパイル時間 | 2,258 ms |
コンパイル使用メモリ | 192,076 KB |
最終ジャッジ日時 | 2025-01-16 07:03:44 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
#include "bits/stdc++.h"using namespace std;using ll = long long;signed main() {int N; cin >> N;int cnt = 0;for (int i = 0; i <= 30; i++) {if (N & (1 << i)) {cnt++;}}if (cnt == 1) {cout << -1 << " " << -1 << " " << -1 << endl; return 0;}int a = 0, b = 0;bool ok = false;for (int i = 0; i <= 30; i++) {if (N & (1 << i)) {if (!ok) {a += (1 << i);ok = true;}else {b += (1 << i);}}}cout << N << " " << a << " " << b << endl;}