Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这样的算法对吗? 我想了好久,理论上是对的,但是提交时…

Posted by 0915174 at 2010-01-01 21:16:10 on Problem 3740
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator