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

我的为什么WA了

Posted by chengmingvictor at 2005-08-09 15:34:46 on Problem 2535
#include <iostream>
#include <cmath> 
#include <memory.h>
#include <vector>
using namespace std;

int const MAX = 110;
int N, P;
int temp[MAX];
int hard[MAX];  //the numver of people to consider it's hard
int easy[MAX];  //the number of people to consider it's easy
vector<int> veryEasy;

void find_hard_easy()
{
    int th = 0, te = 1000;
    for(int i = 1; i <= P; i++)
    {
        cin>>temp[i];
        if(temp[i] > th)
                th = temp[i];
        else if(temp[i] < te)
                te = temp[i];
    }
    
    for(int j = 1; j <= P; j++)
        if(temp[j] == th)
                hard[j] ++;
        else if(temp[j] == te)
                easy[j] ++;
}    

int main()
{
    cin>>N>>P;
    memset(hard, 0, sizeof(hard));
    memset(easy, 0, sizeof(easy));
    for(int i = 1; i <= N; i++)
        find_hard_easy();     
             
    veryEasy.clear();
    for(int j = 1; j <= P; j++)
        if(easy[j] > N/2 && hard[j] == 0)
                veryEasy.push_back(j);
                
    if(veryEasy.size())
    {
        cout<<veryEasy[0];
        for(int i = 1; i < veryEasy.size(); i++)
                cout<<' '<<veryEasy[i];
        cout<<endl;
    }
    else 
        cout<<0<<endl;    
    //system("PAUSE");	
    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