代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#define INF 1<<30
using namespace std;
int a[1005];
int main()
{
int n;
int i,j;
while(scanf("%d",&n)==1)
{
int ans1=0,ans2=0,ans3=0,ans5=-INF;
double ans4;
int s=0;
int cnt=0;
int k=0;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]%5==0&&a[i]%2==0)
{
ans1+=a[i];
}
if(a[i]%5==1)
{
++cnt;
if(cnt%2==1)
ans2+=a[i];
else
ans2-=a[i];
}
if(a[i]%5==2)
ans3++;
if(a[i]%5==3)
{
s+=a[i];
k++;
}
if(a[i]%5==4)
{
if(a[i]>ans5)
{
ans5=a[i];
}
}
}
ans4=s*1.0/k;
if(ans1==0)
printf("N ");
else
printf("%d ",ans1);
if(cnt==0)
printf("N ");
else
printf("%d ",ans2);
if(ans3==0)
printf("N ");
else
printf("%d ",ans3);
if(k==0)
printf("N ");
else
printf("%.1lf ",ans4);
if(ans5==-INF)
printf("N\n");
else
printf("%d\n",ans5);
}
return 0;
}