-
Notifications
You must be signed in to change notification settings - Fork 52
/
75A. Life Without Zeros.cpp
41 lines (39 loc) · 870 Bytes
/
75A. 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
//============================================================================
//problem link:http://codeforces.com/gym/101581/problem/A
// Name : .cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//status:accepted
//============================================================================
#include<string>
#include <iostream>
using namespace std;
long long removezero(long long a){
string s=to_string(a);
string s2;
int n=s.length();
for(int i=0;i<n;i++){
if(s[i]!='0'){
s2+=s[i];
}
}
return stoll(s2);
}
int main() {
long long a,b;
cin>>a>>b;
long long result1=a+b;
long long result2;
long long newa=removezero(a);
long long newb=removezero(b);
result2=removezero(result1);
if((newa+newb)==result2){
cout<<"YES";
}
else{
cout<<"NO";
}
return 0;
}