| ||||||||||
| 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 | |||||||||
这几个simple太阴险了#include <iostream>//我很疑惑问什么我开的内存少反而比另外一个人的内存占用多?希望大牛赐教
#include <iomanip>
using namespace std;
int n;
int n1,total1;
int temp;
double total;
int a[1003];
int main()
{
cin>>n;
for (int i=0;i<n;i++)
{
total=0;
total1=0;
cin>>n1;
for (int j=0;j<n1;j++)
{
cin>>a[j];
total+=a[j];
}
total=total/n1;
for (int j=0;j<n1;j++) 《----------写成n几个例子全过了。
if ((double)a[j]>total) total1++;
cout<<fixed<<setprecision(3)<<(double)100*total1/n1<<"%"<<endl;//不写float没有小数点
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator