题解 | #记负均正#
记负均正
http://www.nowcoder.com/practice/6abde6ffcc354ea1a8333836bd6876b8
#include<iostream>
using namespace std;
int main()
{
int d;
while(cin>>d)
{
int sum=0;
int fcout=0;
int zcount=0;
while(d--)
{
int v;
cin>>v;
if(v<0)
{
fcout++;
}
else if(v>0)
{
zcount++;
sum+=v;
}
}
double ave=0.0;
if(zcount>0)
{
ave=sum*1.0/zcount;
}
cout<<fcout<<" ";
printf("%.1lf\n",ave);
}
}