結果
問題 | No.2323 Nafmo、A+Bをする |
ユーザー |
|
提出日時 | 2023-05-28 13:36:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 555 bytes |
コンパイル時間 | 1,886 ms |
コンパイル使用メモリ | 195,216 KB |
最終ジャッジ日時 | 2025-02-13 09:59:34 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;#define rep(i,n) for (int i=0;i<(int)(n);i++)int main(){string x,y;cin>>x>>y;vector<int> ans;while(x.size()>0&&y.size()>0){if(x.back()==y.back()){ans.push_back(0);}else{ans.push_back(1);}x.pop_back();y.pop_back();}while(x.size()>0){ ans.push_back(x.back()-'0'); x.pop_back();}while(y.size()>0){ ans.push_back(y.back()-'0'); y.pop_back();}ll c=0;ll pw=1;for(int i:ans){c+=i*pw;pw*=2;}cout<<c<<endl;}