Advertisement
Graf_Rav

Danov1802 27.4

May 25th, 2018
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.     int n;
  8.     cin>>n;
  9.    
  10.     vector< vector<int> > c(3, vector<int> (2, 0));
  11.    
  12.     for(int i=0;i<n;i++){
  13.         int a;
  14.         cin>>a;
  15.         c[a%3][(int)(a%5==0)]++;
  16.     }
  17.    
  18.     int ans=(c[0][1]*c[0][1]-1)/2;
  19.     ans+=c[0][1]*c[0][0];
  20.     ans+=c[1][1]*c[2][0];
  21.     ans+=c[2][1]*c[1][0];
  22.     ans+=c[1][1]*c[2][1];
  23.    
  24.     cout<<ans;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement