Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // хоть один больше сотни, сумма делится на 80
- #include <iostream>
- using namespace std;
- int main(){
- const int m=80,
- b =100;
- int N,temp,arr[2][81];
- for(int i=0; i<2; ++i){
- for(int j=0; j<81; ++j){
- arr[i][j]=0;
- }
- }
- cin >>N;
- for(int i=0; i<N; ++i){
- cin >> temp;
- if(temp < b)
- arr[0][temp%m]++;
- else
- arr[1][temp%m]++;
- }
- int sum=0;
- for(int i=0; i<m; ++i){
- if(i!=m/2){
- sum += arr[1][i] * arr[1][m-i];
- }
- if(i==m/2 and arr[1][i]>1){
- sum+= arr[1][i]*(arr[1][i]-1)/2;
- }
- sum+= arr[1][i] * arr[0][m-i];
- }
- cout << sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement