結果
問題 | No.2086 A+B問題 |
ユーザー |
|
提出日時 | 2023-01-27 20:20:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 2,775 bytes |
コンパイル時間 | 1,677 ms |
コンパイル使用メモリ | 195,732 KB |
最終ジャッジ日時 | 2025-02-10 07:23:42 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include<bits/stdc++.h>using ll = long long;#define REP(i, n) for(ll i = 0; (i) < ll(n); ++ (i))#define FOR(i, m, n) for(ll i = (m); (i) <= ll(n); ++ (i))#define REPR(i, n) for(ll i = ll(n) - 1; (i) >= 0; -- (i))#define FORR(i, m, n) for(ll i = ll(n); (i) >= ll(m); -- (i))#define ALL(x) x.begin(),x.end()#define INF (int)1e9#define LLINF (long long)1e18#define MOD (int)(1e9+7)#define MOD9 (int)998244353#define PI 3.141592653589#define PB push_back#define F first#define S second#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}#define Yes(T) {cout<<"Yes"<<endl; if(T) return 0;}#define No(T) {cout <<"No"<<endl; if(T) return 0;}#define YES(T) {cout<<"YES"<<endl; if(T) return 0;}#define NO(T) {cout <<"NO"<<endl; if(T) return 0;}#define Graph vector<vector<int> >#define CostGraph vector<vector<pair<int,ll> > >#define PII pair<int,int>#define PLL pair<ll,ll>#define VI vector<int>#define VL vector<ll>#define VVI vector<vector<int> >#define VVL vector<vector<ll> >#define VPII vector<pair<int,int> >#define VPLL vector<pair<ll,ll> >#define DDD fixed<<setprecision(10)#define PAD setfill('0')<<right<<setw(8)template <class T>inline bool chmin(T &a, T b) {if(a > b){ a = b; return true;}return false;}template <class T>inline bool chmax(T &a, T b) {if(a < b){a = b; return true;}return false;}template <class T>T GCD(T a, T b) {if (b == 0) return a;return GCD(b, a % b);}template <class T>inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}struct input{int n;input() {}input(int n_) : n(n_){};template <class T>operator T(){T ret;std::cin >> ret;return ret;}template <class T>operator std::vector<T>() {std::vector<T> ret(n);REP(i,n) std::cin >> ret[i];return ret;}};template <class T>inline void printVec(std::vector<T> v){REP(i,v.size()){if(i) std::cout << " ";std::cout << v[i];} std::cout << std::endl;}using namespace std;// #include <atcoder/all>// using namespace atcoder;// using mint = modint998244353;int main(){ios::sync_with_stdio(false);cin.tie(nullptr);string a, b;cin >> a >> b;VI A(201, 0), B(201, 0);reverse(ALL(a)), reverse(ALL(b));REP(i,a.length()) A[i] = a[i] - '0';REP(i,b.length()) B[i] = b[i] - '0';VI ans(201, 0);REP(i,200){ans[i] += A[i] + B[i];if(ans[i] >= 10){ans[i+1]++;ans[i] -= 10;}}reverse(ALL(ans));bool flg = false;REP(i,201){if(ans[i] != 0) flg = true;if(ans[i] == 0 && !flg) continue;cout << ans[i];}if(!flg) cout << 0;cout << endl;}