| ||||||||||
| 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 | |||||||||
下面的程序有什么错语呢??我记录了第一和第二的,与第二相等的就是第二。。。#include <iostream>
using namespace std;
int main()
{
int m, n;
cin>>m>>n;
while((m!=0) && (n!=0))
{
int players[10001];
for(int i=0; i<10001; i++)
players[i]=0;
int temp;
int max=-1, sec=-1;
for(int i=0; i<m; i++)
for(int j=0; j<n; j++)
{
cin>>temp;
players[temp]++;
if(players[temp]>max)
{
sec=max;
max=players[temp];
}else if(players[temp]<max && players[temp]>sec)
{
sec=players[temp];
}
}
for(int i=1; i<=10000; i++)
if(players[i]==sec)
cout<<i<<" ";
cout<<endl;
cin>>m>>n;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator