Advertisement
askarulytarlan

A regional

Dec 6th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define ll long long
  6.  
  7. string s;
  8. bool pr = 0;
  9. long long ch, nech;
  10.  
  11. int main(){
  12. cin >> s;
  13. for(int i = 0; i < s.size(); i++){
  14. if(pr){
  15. ch+= ((int)s[i]-48);
  16. pr = 0;
  17. }
  18. else{
  19. nech+= ((int)s[i]-48);
  20. pr = 1;
  21. }
  22. }
  23. if((ch - nech) % 11 == 0){
  24. cout << "YES";
  25. }
  26. else{
  27. cout << "NO";
  28. }
  29. cout << endl;
  30. cout << ch - nech;
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement