Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
1A留念,哈哈,贴个代码献丑,轻拍呀~#include <iostream> using namespace std; int trans(int a) { if(a % 10 == 0) { while(a % 10 == 0) { a = a / 10; } } return a; } int reverse(int b) { int c = 0; while(b) { c = c * 10 + b % 10; b = b / 10; } return c; } int main() { int n, a, b, sum; int i, j, k; cin>>n; while(n--) { cin>>a>>b; a = trans(a); b = trans(b); a = reverse(a); b = reverse(b); sum = trans(a+b); sum = reverse(sum); cout<<sum<<endl; } //system("pause"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator