-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC - Life Without Zeros.cpp
104 lines (93 loc) · 1.96 KB
/
C - Life Without Zeros.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <string.h>
#include <sstream>
#include <fstream>
#include <algorithm>
using namespace std;
#define iDeBug 1
#define D(x) if(iDeBug) cout << __LINE__ << " " << #x" = " << (x) << endl
#define D2(x,y) if(iDeBug) cout << __LINE__ << " " << #x" = " << (x) \
<< ", " << #y" = " << (y) << endl
#define READ(f) freopen( (f), "r", stdin )
#define WRITE(f) freopen( (f), "w", stdout )
#define mset(x,n) memset((x),(n),sizeof((x)))
#define pf(x) cout << (x)
#define pfl(x) cout << (x) << endl
#define pfnl() cout << endl
#define pfs() cout << " "
#define FOR(i,a,b) for(int i=(a); i<b; i++)
#define FORE(i,a,b) for(int i=(a);i<=b;i++)
#define REV(i,a,b) for(int i=(a); i>=b; i--)
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> V;
int main(){
LL a,b,x,c,n=0,r=0,y,z,v=0,u=0,m,q,t=0,i,ans1=0,ans2=0;
cin>>a>>b;
c=a+b;
while(a!=0||b!=0)
{
x=a%10;
a=a/10;
if(x!=0)
{
n=n*10+x;
}
//######################################
z=b%10;
b=b/10;
if(z!=0)
{
v=v*10+z;
}
}
while(n!=0||v!=0)
{
if(n!=0)
{
y=n%10;
n=n/10;
r=r*10+y;
}
//######################################
if(v!=0)
{
m=v%10;
v=v/10;
u=u*10+m;
}
}
while(c!=0)
{
q=c%10;
c=c/10;
if(q!=0)
{
t=t*10+q;
}
}
while(t!=0)
{
i=t%10;
t=t/10;
ans1=ans1*10+i;
}
ans2=r+u;
if(ans1==ans2)
cout<<"YES";
else
cout<<"NO";
return 0;
}