| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
不要除法,用乘法In Reply To:为什么我用了double还是wa Posted by:ageless at 2005-05-25 10:26:11 > int main()
> {
> int n,m,sum,count;
> double avg;
> int i,j;
> int a[1000];
> scanf("%d",&n);
> for(i=0;i<n;i++){
> scanf("%d",&m);
> sum=0;
> for(j=0;j<m;j++){
> scanf("%d",&a[j]);
> sum=sum+a[j];
> }
> avg=(double)sum/m;
> count=0;
> for(j=0;j<m;j++){
> if(a[j]>avg){
> count++;
> }
> }
> printf("%.3f%\n",(double)count*100/m);
> }
> return 0;
> }
>
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator