Advertisement
Frinom

C++ ::6

Feb 4th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <math.h>
  4. #include <conio.h>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.     int N, a, kol[3] = {};
  10.     int m;
  11.     cin >> N;
  12.  
  13.     for (int i = 0; i < N; i++)
  14.     {
  15.         cin >> a;
  16.         if (a%2 == 0 && a%3 != 0)
  17.         {
  18.             kol[0]++;
  19.         }
  20.         if (a%3 == 0 && a%2 != 0)
  21.         {
  22.             kol[1]++;
  23.         }
  24.         if (a%6 == 0)
  25.         {
  26.             kol[2]++;
  27.         }
  28.     }
  29.  
  30.     m = (kol[2])*0.5*(kol[2]-1) + (kol[1] * kol[0]) + (kol[2]*(N-kol[2]));
  31.    
  32.     cout << m;
  33.  
  34.     _getch();
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement