結果
| 問題 |
No.2323 Nafmo、A+Bをする
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-28 13:46:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 553 bytes |
| コンパイル時間 | 1,852 ms |
| コンパイル使用メモリ | 193,928 KB |
| 最終ジャッジ日時 | 2025-02-13 10:17:10 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string a, b;
cin >> a >> b;
long long ans = 0, two = 1;
reverse(a.begin(), a.end());
reverse(b.begin(), b.end());
for (int i = 0; i < 50; i++) {
if (i >= a.size() && i >= b.size()) break;
else if (i >= a.size()) {
if (b[i] == '1') ans += two;
} else if (i >= b.size()) {
if (a[i] == '1') ans += two;
} else {
if (!(a[i] == b[i])) ans += two;
}
two *= 2;
}
cout << ans << endl;
return 0;
}