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 zjp at 2009-08-24 14:59:52 on Problem 3112
#include <stdio.h> 
int  x[1000][1000];
  int main() 
  { 
   int p,n,c;int i,j,sum,flag;
   
   
   while (EOF!=scanf("%d %d %d",&p,&n,&c))
   {
     int k=0;
     if (p==0&&n==0&&c==0)
     	break;
      for (i=0;i<n;i++)
	  { for (j=0;j<p;j++)
	    scanf("%d",&x[i][j]);
	    
	  }
    
	  for (j=0;j<p;j++)
	   {  sum=0; 
		   for (i=0;i<n;i++)
		   {	   flag=sum;	
			   sum=sum+x[i][j];
		    if (sum>flag)
			{	if (i==n-1&&sum>=c)
			{k++;sum=0;}
			    else if (i!=n-1)
				continue;
			}
			else if (sum>=c)
			{	k++;sum=0;}
				
			else sum=0;

		   }
       }

	  

     printf("%d\n",k);
  

        
       
     }
   return 0;   
         	
      }

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