Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 2 KBi |
#2 |
Correcto
|
0.007 s | 1 KBi |
#3 |
Correcto
|
0.006 s | 2 KBi |
#4 |
Incorrecto
|
0.005 s | 2 KBi |
#5 |
Correcto
|
0.006 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 1 KBi |
#7 |
Correcto
|
0.006 s | 1 KBi |
#8 |
Correcto
|
0.007 s | 1 KBi |
#9 |
Correcto
|
0.006 s | 2 KBi |
#10 |
Correcto
|
0.008 s | 2 KBi |
#11 |
Correcto
|
0.005 s | 2 KBi |
#12 |
Correcto
|
0.007 s | 1 KBi |
#13 |
Correcto
|
0.006 s | 1 KBi |
#14 |
Correcto
|
0.007 s | 2 KBi |
#15 |
Correcto
|
0.004 s | 2 KBi |
#16 |
Correcto
|
0.006 s | 2 KBi |
#17 |
Incorrecto
|
0.006 s | 1 KBi |
#18 |
Incorrecto
|
0.006 s | 2 KBi |
#19 |
Correcto
|
0.006 s | 1 KBi |
#20 |
Correcto
|
0.006 s | 2 KBi |
#21 |
Correcto
|
0.007 s | 1 KBi |
#22 |
Correcto
|
0.005 s | 1 KBi |
#23 |
Incorrecto
|
0.005 s | 1 KBi |
#24 |
Correcto
|
0.006 s | 2 KBi |
#25 |
Incorrecto
|
0.006 s | 2 KBi |
#26 |
Incorrecto
|
0.006 s | 1 KBi |
#27 |
Incorrecto
|
0.004 s | 1 KBi |
#28 |
Incorrecto
|
0.006 s | 1 KBi |
#29 |
Incorrecto
|
0.007 s | 2 KBi |
#30 |
Incorrecto
|
0.006 s | 2 KBi |
#31 |
Incorrecto
|
0.006 s | 2 KBi |
#32 |
Incorrecto
|
0.006 s | 2 KBi |
#33 |
Incorrecto
|
0.007 s | 2 KBi |
#34 |
Incorrecto
|
0.007 s | 1 KBi |
#35 |
Incorrecto
|
0.008 s | 1 KBi |
#36 |
Correcto
|
0.005 s | 2 KBi |
#37 |
Incorrecto
|
0.008 s | 1 KBi |
#38 |
Incorrecto
|
0.005 s | 2 KBi |
#include <bits/stdc++.h> #define ii pair<int,int> #define F first #define S second #define pb push_back #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define fore(i, a, b) for(int i = a; i < b; i += 1) #define forr(i, a) for(int i = a; i >= 0; i--) #define sz(s) int(s.size()) #define cls(a,car) memset(a,car,sizeof (a)) #define db(x) cout << #x << " is " << x << '\n' #define angle(x) double(x * acos(-1) / 180.0) using namespace std; void debug(){cout << endl;} template<typename T, typename... Args> void debug(T a, Args... args){cout << a << " "; debug(args...);} typedef long long ll; typedef vector<int> vi; typedef vector<ii> vii; const int N = 1e4 + 10; const ll mod = 1e9 + 7; const double E = 1e-7; string f(string &a, string &b){ string aux(sz(b) - sz(a), '0'); return aux + a; } string sum(string &a, string &b){ string ans(sz(a), '0'); int acc = 0; for(int i = sz(a) - 1; i >= 0; i--){ int cur = (a[i] - '0') + (b[i] - '0'); ans[i] = char((cur + acc) % 10 + '0'); if(cur >= 10){ cur /= 10; acc = cur % 10; } else acc = 0; } string aux = ""; if(acc){ aux += char(acc + '0'); ans = aux + ans; } return ans; } void solve(){ string a, b; cin >> a >> b; if(sz(a) < sz(b)) a = f(a, b); else b = f(b, a); cout << sum(a, b) << '\n'; } int main(){ #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #else ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #endif int t = 1; //cin >> t; for(int i = 1; i <= t; i++){ solve(); } #ifdef LOCAL cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif return 0; }