結果
| 問題 | No.1298 OR XOR | 
| コンテスト | |
| ユーザー |  monnu | 
| 提出日時 | 2021-04-17 22:20:01 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 602 bytes | 
| コンパイル時間 | 1,339 ms | 
| コンパイル使用メモリ | 165,976 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-04 04:16:02 | 
| 合計ジャッジ時間 | 1,991 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 13 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 200003
#define MOD 998244353
#define INF 1000000000
int main(){
  int N;
  cin>>N;
  int A=0;
  int B=0;
  int C=0;
  int k=0;
  for(int i=0;i<31;i++){
    if(((N>>i)&1)==1){
      if(k==0){
        A+=(1<<i);
        B+=(1<<i);
        k=1;
      }else if(k==1){
        B+=(1<<i);
        C+=(1<<i);
        k=0;
      }
    }
  }
  if(A==0||B==0||C==0){
    cout<<"-1 -1 -1"<<endl;
  }else{
    cout<<A<<" "<<B<<" "<<C<<endl;
  }
}
            
            
            
        