Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这几个simple太阴险了

Posted by baicaited at 2009-04-30 23:29:25 on Problem 2350
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator