結果

問題 No.1298 OR XOR
ユーザー ShibuyapShibuyap
提出日時 2020-12-04 09:18:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 674 bytes
コンパイル時間 2,153 ms
コンパイル使用メモリ 198,400 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 21:26:38
合計ジャッジ時間 4,011 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
4,352 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:26:37: 警告: ‘c’ may be used uninitialized [-Wmaybe-uninitialized]
   26 |     cout << a << ' ' << b << ' ' << c << endl;
      |                                     ^
main.cpp:13:15: 備考: ‘c’ はここで定義されています
   13 |     int a, b, c;
      |               ^
main.cpp:26:30: 警告: ‘b’ may be used uninitialized [-Wmaybe-uninitialized]
   26 |     cout << a << ' ' << b << ' ' << c << endl;
      |                              ^~~
main.cpp:13:12: 備考: ‘b’ はここで定義されています
   13 |     int a, b, c;
      |            ^

ソースコード

diff #

#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 200005

int 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;
}
 
 
0