結果

問題 No.581 XOR
ユーザー polylogKpolylogK
提出日時 2017-10-27 22:28:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 659 bytes
コンパイル時間 1,625 ms
コンパイル使用メモリ 170,424 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 16:26:33
合計ジャッジ時間 2,019 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 WA -
testcase_03 AC 2 ms
6,940 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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