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

看看我的为什么不AC啊,求救(附代码)!!!!!!!!!!!!!!!!

Posted by inforyou at 2007-04-19 22:13:42 on Problem 3112
#include <stdio.h>
#include <stdlib.h>
#define max 1000

void main()
{
	int i,j,digit[max],ones[max],k = 0,num[max],P,N,C,m = 0;
	for(i = 0; i < max; i++)
		num[i] = 0;
	while(1)
	{
		scanf("%d%d%d",&P,&N,&C);
		if(P == 0 && N == 0 && C == 0) break;
		ones[k] = 0;
        
		for(i = 0; i < N; i++)
			for(j = 0; j < P; j++)
			{
		         scanf("%d",&digit[j]);
				 if(digit[j] == 1)
					 num[j]++;
				 else
				 {
					 if(num[j] >= C)
						 ones[k]++;
					 num[j] = 0;
				 }
			}
		for(i = 0; i < P; i++)
			if(num[i] >= C)
			{
				ones[k]++;
				num[i] = 0;
			}
			k++;
	}
	for(i = 0; i < k; i++)
	    printf("%d\n",ones[i]);
}

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