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"stdio.h" main(){ int a[16][200],c,b,i,j,flag=1,n; while(scanf("%d%d",&c,&b)!=EOF){ for(i=0;i<c;i++) for(j=0;j<b;j++) scanf("%d",&a[i][j]); for(i=0,n=0;i<c;i++) if(flag) for(j=0;j<b;j++) {if(a[i][j]==1) n++; if(n>=2) {flag=0;break;}} } if(flag) printf("Yes,I found it"); else printf("It is impossible"); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator