murugappan_s

Toughest Solution

Oct 14th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define ll long long
  3. #define ld long double
  4. #define pb push_back
  5. #define x first
  6. #define y second
  7. #define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  8. #define PI (atan(1)*4)
  9. #define mp make_pair
  10. using namespace std;
  11.  
  12. int main()
  13. {
  14.     fastread;
  15.     int n, ans = 0, val;
  16.     string s;
  17.     cin >> n;
  18.     for (int i = 0; i < n; i++) {
  19.         cin >> s;
  20.         val = 0;
  21.         for (int j = 0; j < s.size(); j++)
  22.             val += s[j] - '0';
  23.         if (val % 3 == 0)
  24.             ans++;
  25.     }
  26.     cout << ans << '\n';
  27.     return 0;
  28. }
Add Comment
Please, Sign In to add comment