結果

問題 No.1298 OR XOR
ユーザー planesplanes
提出日時 2022-07-29 20:22:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 1,532 ms
コンパイル使用メモリ 164,424 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-26 17:13:09
合計ジャッジ時間 4,643 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
次のファイルから読み込み:  /usr/local/gcc7/include/c++/12.2.0/istream:39,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/sstream:38,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/complex:45,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/ccomplex:39,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/x86_64-pc-linux-gnu/bits/stdc++.h:54,
         次から読み込み:  main.cpp:1:
メンバ関数 ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’ 内,
    inlined from ‘int main()’ at main.cpp:20:22:
/usr/local/gcc7/include/c++/12.2.0/ostream:202:25: 警告: ‘B’ may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: 関数 ‘int main()’ 内:
main.cpp:10:8: 備考: ‘B’ はここで定義されています
   10 |   ll A,B,C;
      |        ^
main.cpp:15:13: 警告: ‘C’ may be used uninitialized [-Wmaybe-uninitialized]
   15 |       else C+=(1LL<<k);
      |            ~^~~~~~~~~~
main.cpp:10:10: 備考: ‘C’ はここで定義されています
   10 |   ll A,B,C;
      |          ^

ソースコード

diff #

#include <bits/stdc++.h> 
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 #define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)

int main() {
  ll N;cin>>N;
  ll A,B,C;
  A=N;
  for(ll k=0;k<=30;k++) {
    if(N&(1LL<<k)){
      if(B==0) B+=(1LL<<k);
      else C+=(1LL<<k);
    }
  }

  if(C==0) cout<<-1<<" "<<-1<<" "<<-1<<endl;
  else cout<<A<<" "<<B<<" "<<C<<endl;
}

    



  


  
0