結果
問題 | No.2323 Nafmo、A+Bをする |
ユーザー | momoyuu |
提出日時 | 2023-05-28 13:34:37 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 466 bytes |
コンパイル時間 | 3,930 ms |
コンパイル使用メモリ | 246,680 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 20:58:05 |
合計ジャッジ時間 | 3,462 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; void solve(){ } int main(){ string a,b; cin>>a>>b; int ans = 0; while(a.size()!=b.size()){ if(a.size()>b.size()) b = string(1,'0') + b; else a = string(1,'0') + a; } for(int i = 0;i<a.size();i++){ int ni = a[i] - '0'; int nj = b[i] - '0'; ni += nj; ni %= 2; ans *= 2; ans += ni; } cout<<ans<<endl; }