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

为什么测试数据全部正确,但是会Runtime Error呢?百思不得其解

Posted by pspay at 2010-11-29 23:02:47 on Problem 1083
#include <stdio.h>
void main(){
	int room[201];
	int h,i,j,k,l;
	int low,high,testcase,s,t,max;
	scanf("%d",&testcase);
	for(h=1;h<=testcase;h++){
		for(i=1;i<=200;i++)room[i]=0;
		scanf("%d",&j);
		for(i=1;i<=j;i++){
			scanf("%d %d",&s,&t);
			low=(s<t)?s:t;
			high=(s>t)?s:t;
			for(k=low;k<=high;k++){
				room[k]++;
			}
			if(low%2==0)room[low-1]++;
			if(high%2==1&&high!=200)room[high+1]++;
		}
		max=room[1];
		for(l=1;l<=200;l++){
			max=(room[l]>max)?room[l]:max;
		}
		printf("%d\n",10*max);
	}
}

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