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 <iostream> using namespace std; int main() { int a[501][501]; int i,j,n,d,flag[501],k; while (1) { memset(flag,0,501*sizeof(int)); cin>>n>>d; if (n==0&&d==0) break; else for (i=0;i<d;i++) { for (j=0;j<n;j++) cin>>a[i][j]; } for (j=0;j<n;j++) { for (k=1;k<d;k++) { if (a[0][j]==a[k][j]&&a[0][j]!=0) flag[j]+=1; else flag[j]+=0; } } for (j=0;j<n;j++) { if (flag[j]==(d-1)) { cout<<"yes"<<endl; break; } else if(j!=(n-1)) continue; else cout<<"no"<<endl; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator