| ||||||||||
| 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 | |||||||||
Re:用double可以过的In Reply To:用double可以过的 Posted by:linmeng at 2005-07-17 09:02:12 > #include <iostream.h>
> #include <stdio.h>
> int c;
> long n;
> long a[1000];
> int main()
> {
> cin>>c;
> while (c)
> {
> c--;
> cin>>n;
> int i;
> long sum=0;
> for (i=1;i<=n;i++)
> {
> cin>>a[i];
> sum+=a[i];
> }
> double xb=(double)sum/(double)n;
> long t=0;
> for (i=1;i<=n;i++)
> {
> if (a[i]>xb) t++;
> }
> xb=(double)t/(double)n*100;
> printf("%.3lf%c\n",xb,'%');
> }
> return 0;
> }
> 你这代码错的啊!!过不了
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator