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

为什么老是WA 给几组测试数据好吗?高手帮帮忙!谢谢!

Posted by 6570615 at 2005-01-11 20:09:32 on Problem 2014
#include<stdio.h>
struct point{
	int x;int y;
}p[15][15];
void main(){
	int m, i,j,t,a[15],max,v,w,t1,t2;
	for(;;){
		for(i=0;i<15;i++){
			for(j=0;j<15;j++){
				p[i][j].x=0;p[i][j].y=0;
			}
		}
		for(i=0;i<15;i++) {a[i]=0;}
	   scanf("%d",&m);
	   if(m==0) break;
	   else if(m>=1&&m<=80){
	      for(i=0,j=0,t=0;;){
		   for(;;j++){
		      scanf("%d%d",&t1,&t2);
              if(t1==-1&&t2==-1) break;
		      t=t+t1;
			  if(t<=m){p[i][j].x=t1;p[i][j].y=t2;}
			  else {i++;j=0;p[i][j].x=t1;p[i][j].y=t2;j++;break;}
		   }
		   if(t1==-1&&t2==-1){a[i]=t; break;}
		   a[i-1]=t-t1;t=t1;
		 }
	     v=a[0];
	     for(i=1;i<15;i++){
		   if(v<a[i]) v=a[i];
		 }
	     w=0;
	     for(i=0;i<15;i++){ 
		   max=p[i][0].y;
		   for(j=1;j<10;j++){
			   if(max<p[i][j].y) max=p[i][j].y;
		   }
		   w=w+max;
		 }
	     printf("%d*%d\n",v,w);
	   }
	}
}

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