ZakenChannel

Second task

Oct 7th, 2020 (edited)
1,415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n, coins, ammountZero = 0, ammountFirst = 0;
  7.     cin >> n;
  8.     for (int i = 0; i < n; i++) {
  9.         cin >> coins;
  10.         if (coins == 0) {
  11.             ammountZero++;
  12.         }
  13.         else {
  14.             ammountFirst++;
  15.         }
  16.     }
  17.     if (ammountZero > ammountFirst) {
  18.         cout << ammountFirst;
  19.     }
  20.     else {
  21.         cout << ammountZero;
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment