MohamedAbdel3al

A. Life Without Zeros

Sep 10th, 2021 (edited)
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std ;
  4. #define sz(s) int(s.size())
  5. typedef long long ll ;
  6.  
  7.  
  8. void ABDEL3AL () {
  9. ios_base::sync_with_stdio(false); cin.tie(nullptr) , cout.tie(nullptr) ;
  10. #ifndef ONLINE_JUDGE
  11. freopen("input.txt" , "r" , stdin) , freopen("output.txt" , "w" , stdout) ;
  12. #endif
  13.  
  14. }
  15.  
  16. int main() {
  17. ABDEL3AL() ;
  18. string a , b , c ;
  19. cin >> a >> b ;
  20. c = to_string(stoi(a) + stoi(b)) ;
  21. a.erase(remove(a.begin() , a.end() , '0')) ;
  22. b.erase(remove(b.begin() , b.end() , '0')) ;
  23. c.erase(remove(c.begin() , c.end() , '0')) ;
  24. cout << (stoll(a) + stoll(b) == stoll(c) ? "YES" : "NO") ;
  25. return 0;
  26. }
  27.  
Add Comment
Please, Sign In to add comment