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 |
wa,不知道为什么,各位帮忙看看啊!#include<stdio.h> int main() { int n,m,i,j,a[101],min,simple[101],number,half,sum,max; char tag[101][103]; scanf("%d%d",&n,&m); for(i=1;i<=n;i++) { min=1001; max=-1; for(j=1;j<=m;j++) { scanf("%d",&a[j]); if(a[j]<min) min=a[j]; if(a[j]>max) max=a[j]; } for(j=1;j<=m;j++) { if(a[j]==max) tag[i][j]='-'; else if(a[j]==min) tag[i][j]='Y'; else tag[i][j]='N'; } } number=0; half=m/2; for(i=1;i<=m;i++) { sum=0; for(j=1;j<=n;j++) { if(tag[j][i]=='Y') sum++; else if(tag[j][i]=='-') { sum=0; break; } } if(sum>half) { number++; simple[number]=i; } } if(number==0) printf("0\n"); else { for(i=1;i<number;i++) printf("%d ",simple[i]); printf("%d\n",simple[number]); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator