| ||||||||||
| 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:help!!!查了半天还是wa阿!In Reply To:help!!!查了半天还是wa阿! Posted by:llk at 2007-10-12 12:31:19 > #include<iostream>
> using namespace std;
> int main()
> {
> int n,m,i,j,count=0,second=0;
> int num;
> int a[10002]={0};
> while(scanf("%d%d",&n,&m))
> {
> if(n==0) return 0;
> for(i=0;i<n;i++)
> {
> for(j=0;j<m;j++)
> {
> scanf("%d",&num);
> a[num]++;
> }
> }
> for(i=1;i<10001;i++)
> {
> if(a[i]>count)
> {
> second=count;
> count=a[i];
> }
> }
> if(second==0)//如果第一个出现的a[i]就是最大的数
> {
> for(i=1;i<10001;i++)
> {
> if(a[i]!=0&&a[i]<count) second=a[i];
> if (a[i]<second) continue;
> }
> }
>
> for(i=1;i<=10000;i++)
> {
> if(a[i]==second) printf("%d ",i);
> a[i]=0;
> }
>
> count=0;second=0;
> printf("\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