#include<stdio.h>
int arr[1005];
int main(){
int N,yu,A1,A2,flag2=1,A3,A4,A4a,A5,A5a=0;
A1=A2=A3=A4=A4a=A5=0;
scanf("%d",&N);
for(int i=0;i<N;i++){//输入数据,放入数组
scanf("%d",&arr[i]);
yu = arr[i]%5;
if(yu==0&&arr[i]%2==0) A1+=arr[i];
if(yu==1&&flag2==1) {A2+=arr[i];flag2=0;continue;}
if(yu==1&&flag2==0) {A2-=arr[i];flag2=1;}
if(yu==2) A3++;
if(yu==3) {A4+=arr[i];A4a++;}
if(yu==4&&A5<arr[i]) {A5=arr[i];A5a++;}
}
for(int i=0;i<5;i++){
if(i!=0) printf(" ");
if((i==0&&A1==0)||(i==1&&A2==0)||(i==2&&A3==0)||(i==3&&A4a==0)||(i==4&&A5a==0)){
printf("N");continue;
}
if(i==0) printf("%d",A1);
if(i==1) printf("%d",A2);
if(i==2) printf("%d",A3);
if(i==3) printf("%.1f",A4/(float)A4a);
if(i==4) printf("%d",A5);
}
return 0;
}
原文地址:https://www.cnblogs.com/hebust/p/9498118.html
时间: 2024-10-07 11:13:27