Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int INf = 10000000;
  4. int a, n, i, s = 0, cnt = 0, m = INf;
  5.  
  6.  
  7. void Solve() {
  8.    
  9. }
  10. void fastio() {
  11.         ios_base::sync_with_stdio(false);
  12.         cin.tie(0);
  13.         cout.tie(0);
  14.     }
  15.  
  16. signed main () {
  17.     fastio();
  18.     cin >> n;
  19.     for (int i = 0; i < n; i++) {
  20.         cin >> a;
  21.         s += a;
  22.         cnt++;
  23.         if((a % 4 != 0) && (a < m)) m = a;
  24.   }
  25.    if((s % 4 == 0) && (m != INf)) {
  26.         s -= m;
  27.         cnt--;
  28.     }
  29.  
  30.    if(s % 4 == 0) {
  31.          cout << 0;
  32.     }
  33.   cout << cnt << " " <<  s;  
  34.  
  35.  
  36.    
  37.  
  38.  
  39.     return 0;
  40.    
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement