結果

問題 No.1298 OR XOR
ユーザー kpinkcat
提出日時 2023-09-01 10:15:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 407 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 868 ms
コンパイル使用メモリ 99,752 KB
最終ジャッジ日時 2025-02-16 15:57:50
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:5: warning: ‘c’ may be used uninitialized [-Wmaybe-uninitialized]
   24 |     if (c == n || n == 1 || n == 2) cout << "-1 -1 -1" << endl;
      |     ^~
main.cpp:14:18: note: ‘c’ was declared here
   14 |     int n, a, b, c;
      |                  ^

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using namespace std;

int main()
{
    int n, a, b, c;
    cin >> n;
    for (int i = 1; i <= n; i++){
        if (n & i){
            c = i;
            break;
        }
    }
    a = n;
    b = n- c;
    if (c == n || n == 1 || n == 2) cout << "-1 -1 -1" << endl;
    else cout << a << " " << b << " " << c << endl;
} 
0