1012 数字分类 (20分)
#include<stdio.h>
int main()
{
int t,i,a[1001];
int sum1=0,sum2=0,flag=1,count1=0,count2=0,max=-100,m=0;
double sum3=0;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d",&a[i]);
if(a[i]%5==0&&a[i]%2==0)
{
sum1+=a[i];
}
if(a[i]%5==1)
{
sum2+=a[i]*flag;
flag=-flag;
m++;
}
if(a[i]%5==2)
{
count1++;
}
if(a[i]%5==3)
{
sum3+=a[i];
count2++;
}
if(a[i]%5==4)
{
if(max<a[i])
max=a[i];
}
}
double ave=sum3/count2;
if(sum1==0) printf("N ");
else printf("%d ",sum1);
if(m==0) printf("N ");
else printf("%d ",sum2);
if(count1==0) printf("N ");
else printf("%d ",count1);
if(count2==0) printf("N ");
else printf("%.1f ",ave);
if(max==-100) printf("N\n");
else printf("%d\n",max);
return 0;
}