全部AC
#include <cstdio>
int valid[5] = {0};
int count[5] = {0};
int p1(int i) {
printf("%d ", valid[i]);
}
void p() {
printf("N ");
}
int main() {
//如果使用数组存储就可以不用这么多的变量
int time = 0, temp = 0;
scanf("%d", &time);
for(int i = 0; i < time; i++) {
scanf("%d", &temp);
if(temp % 5 == 0 && temp % 2 == 0) {
valid[0] += temp;
count[0]++;
}
if(temp % 5 == 1) {
if(count[1] % 2 == 0) {
valid[1] += temp;
} else if(count[1] % 2 == 1) {
valid[1] -= temp;
}
count[1]++;
}
if(temp % 5 == 2) {
valid[2]++;
count[2]++;
}
if(temp % 5 == 3) {
valid[3] += temp;
count[3]++;
}
if(temp % 5 == 4) {
if(temp > valid[4]) {
valid[4] = temp;
count[4]++;
}
}
}
if(count[0] != 0) p1(0);
else p();
if(count[1] != 0) p1(1);
else p();
if(count[2] != 0) printf("%d ", count[2]);
else p();
if(count[3] != 0) printf("%.1f ", (double)valid[3] / count[3]);
else p();
if(count[4] != 0) p1(4);
else printf("N");
return 0;
}