結果
問題 |
No.8057 A xor B = C
|
ユーザー |
![]() |
提出日時 | 2020-04-01 21:37:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 640 bytes |
コンパイル時間 | 2,424 ms |
コンパイル使用メモリ | 191,432 KB |
最終ジャッジ日時 | 2025-01-09 11:46:23 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long ll myXOR(ll x, ll y) { ll res = 0; // Initialize result // Assuming 32-bit Integer for (ll i = 31; i >= 0; i--) { // Find current bits in x and y bool b1 = x & (1 << i); bool b2 = y & (1 << i); // If both are 1 then 0 else xor is same as OR bool xoredBit = (b1 & b2) ? 0 : (b1 | b2); // Update result res <<= 1; res |= xoredBit; } return res; } int main(){ long long int a=5,b=3; cin>>a>>b; long long int c=(a|b)&(~a|~b); cout<<(myXOR(a,b))<<endl; return 0; }