https://pintia.cn/problem-sets/994805260223102976/problems
#include<iostream> //未通过全部测试
#include<vector>
using namespace std ;
vector <int> v[5] ;
int main(){
int A1 = 0 , A2 = 0 , A5 = 0 ;
double A4 = 0;
int N , num ;
cin >> N;
for (int i = 0 ; i < N ; i++){
cin >> num ;
v[num%5].push_back(num) ;
}
for (int i = 0 ; i < 5 ; i++){
for (int j = 0 ; j < v[i].size() ; j++){
if (i == 0 && v[i][j] % 2 == 0) A1 += v[i][j] ;
if (i == 1 && j % 2 == 0) A2 += v[i][j] ;
if (i == 1 && j % 2 == 1) A2 -= v[i][j] ;
if (i == 3 ) A4 += v[i][j] ;
if (i == 4 && v[i][j] >= A5) A5 = v[i][j] ;
}
}
double a[5] = {A1, A2 ,v[2].size() , A4 / v[3].size() , A5} ;
for (int i = 0 ; i < 5 ; i++){
if ( i != 0 ) printf(" ");
if ( a[i] == 0.0)
printf("N") ;
else if ( i == 3 )
printf("%.1f" , a[3]) ;
else
printf("%d" , (int)a[i]);
}
return 0 ;
}