結果
| 問題 |
No.581 XOR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-27 22:28:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 659 bytes |
| コンパイル時間 | 1,768 ms |
| コンパイル使用メモリ | 168,580 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-21 21:38:20 |
| 合計ジャッジ時間 | 2,159 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 6 |
ソースコード
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
int a,c;
int main(){
cin >> a >> c;
int i=0;
vector<int> vec;
while((a>>i) or (c>>i)){
if((a>>i)==1 and (c>>i)==1) vec.push_back(0);
else if((a>>i)==1 and (c>>i)==0) vec.push_back(1);
else if((a>>i)==0 and (c>>i)==1) vec.push_back(1);
else vec.push_back(0);
i++;
}
int tmp=1,pot=0;
REP(i,0,vec.size()) pot+=vec[i]*tmp,tmp*=2;
cout << pot << endl;
return 0;
}