tuttelikz

#106 - Монетки [+]

Sep 26th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <cstdio>
  6. #include <math.h>
  7. #include <string>
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include <string>
  11. #include <stdlib.h>
  12. #include <cmath>
  13. #include <iomanip>
  14. #include <fstream>
  15. #include <queue>
  16.  
  17. using namespace std;
  18.  
  19. int main(int argc, const char * argv[]) {
  20.     int N;
  21.     int countOnes = 0;
  22.     int countZeros = 0;
  23.     int coins[100];
  24.    
  25.     cin>>N;
  26.    
  27.     for (int i=0;i<N;i++) {
  28.         cin>>coins[i];
  29.     }
  30.    
  31.     for (int i=0;i<N;i++) {
  32.         if (coins[i] == 0) {
  33.             countZeros++;
  34.         }
  35.         else {
  36.             countOnes++;
  37.         }
  38.     }
  39.     cout<<min(countOnes, countZeros)<<endl;
  40.    
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment