http://codeforces.com/contest/75
A
1 #include<bits/stdc++.h> 2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define pb push_back 7 #define eb emplace_back 8 #define maxn 1000006 9 #define eps 1e-8 10 #define pi acos(-1.0) 11 #define rep(k,i,j) for(int k=i;k<j;k++) 12 typedef long long ll; 13 typedef unsigned long long ull; 14 15 16 int main(){ 17 #ifndef ONLINE_JUDGE 18 // freopen("input.txt","r",stdin); 19 #endif 20 std::ios::sync_with_stdio(false); 21 int a,b,c; 22 cin>>a>>b; 23 c=a+b; 24 int ccc=0; 25 int aa=0,bb=0,cc; 26 int p=1; 27 while(a){ 28 int tmp=a%10; 29 if(tmp!=0){ 30 aa+=(tmp)*p; 31 p*=10; 32 } 33 a/=10; 34 } 35 p=1; 36 while(b){ 37 int tmp=b%10; 38 if(tmp!=0){ 39 bb+=(tmp)*p; 40 p*=10; 41 } 42 b/=10; 43 } 44 p=1; 45 while(c){ 46 int tmp=c%10; 47 if(tmp!=0){ 48 ccc+=(tmp)*p; 49 p*=10; 50 } 51 c/=10; 52 } 53 cc=aa+bb; 54 if(cc==ccc) cout<<"YES"<<endl; 55 else cout<<"NO"<<endl; 56 }