Created
September 28, 2016 07:29
-
-
Save ititorit/b9b3fc4166a22492a2b5ba855071350d to your computer and use it in GitHub Desktop.
ADDREV SPOJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// contest: http://www.spoj.com/problems/ADDREV/ | |
// author : Nguyen Minh Tuan (ititorit) | |
// lang : C/C++ | |
#include <bits/stdc++.h> | |
#define _for(i,a,b) for(int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_) | |
#define FOR(i,a,b) for(int i = a; i <= b; i++) | |
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i) | |
#define _all(v) v.begin(), v.end() | |
#define DEBUG(x) { cout << #x << " = " << x << endl; } | |
#define sqr(x) ((x)*(x)) | |
using namespace std; | |
typedef long long ll; | |
typedef unsigned long long ull; | |
int rev(int n) { | |
int s = 0; | |
while(n) { | |
s = 10*s + n%10; | |
n/=10; | |
} | |
return s; | |
} | |
int main(){ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
// solution starts... | |
int test, a, b; | |
cin >> test; | |
while(test--) { | |
cin >> a >> b; | |
cout << rev(rev(a) + rev(b)) << endl; | |
} | |
// solution ends... | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment