jakaria_hossain

codeforce - Life Without Zeros

Apr 5th, 2019
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
  4. int RemoveZero(int a)
  5. {
  6. int sum=0,dig,pos=1;
  7. while(a)
  8. {
  9. dig=a%10;
  10. a/=10;
  11. while(dig)
  12. {
  13. sum+=(dig*pos);
  14. pos*=10;
  15. dig/=10;
  16. }
  17. }
  18. return sum;
  19. }
  20. int main()
  21. {
  22. int a,b,c;
  23. fastread();
  24. cin>>a>>b;
  25. c=a+b;
  26. a= RemoveZero(a);
  27. b=RemoveZero(b);
  28. c=RemoveZero(c);
  29. if(a+b==c)
  30. {
  31. printf("YES\n");
  32. }
  33. else printf("NO\n");
  34. return 0;
  35. }
RAW Paste Data