#include<cstdio>
int main() {
int count[5] = {0};
int ans[5] = {0};
int n,temp;
scanf("%d",&n);
for(int i=0; i<n; i++) {
scanf("%d",&temp);
if(temp%5 == 0) {
if(temp%2 == 0) {
ans[0] += temp;
count[0]++;
}
} else if(temp%5 == 1) {
count[1]++;
if(count[1]%2 ==0) {
ans[1]-=temp;
} else {
ans[1]+=temp;
}
} else if(temp%5 == 2) {
count[2]++;
} else if(temp%5 ==3) {
count[3]++;
ans[3] +=temp;
} else if(temp%5 ==4) {
if(temp>ans[4]) {
ans[4] = temp;
}
count[4]++;
}
}
if(count[0] == 0)
printf("N ");
else printf("%d ",ans[0]);
if(count[1] == 0)
printf("N ");
else printf("%d ",ans[1]);
if(count[2] == 0)
printf("N ");
else printf("%d ",count[2]);
if(count[3] == 0)
printf("N ");
else printf("%d ",(double)ans[3]/count[3]);
if(count[4] == 0)
printf("N");
else printf("%d",ans[4]);
return 0;
}
PAT B1012
最新推荐文章于 2024-11-13 21:27:59 发布