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 20092381 at 2010-07-24 21:33:24 on Problem 1042
#include"iostream"
#include<stdio.h>
using namespace std;
int main()
{
	int n,h,fi[26],di[26],ti[26],i,j,t,re,rp[26];
	while(scanf("%d",&n)&&n)
	{
		int max[26]={0},rem[26][26]={0},max1=-1;
		scanf("%d",&h);
		for(i=1;i<=n;i++)
			scanf("%d",&fi[i]);
		for(i=1;i<=n;i++)
			scanf("%d",&di[i]);
		for(i=1;i<n;i++)
			scanf("%d",&ti[i]);
	     	ti[0]=0;
		for(i=1;i<=n;i++)
		{
			t=12*h;
			for(j=1;j<=i;j++)
			{
				t-=ti[j-1];
				rp[j]=fi[j];
			}
			while(t>0)\\这里改成t!=0耗时2000+毫秒 不改耗时60+而且\\测试数据应该都是整数吧我里面变量都是整型的t--总得经过t=0这一点啊,求测试数据或原因
			{
			  for(j=1;j<=i;j++)
				  if(max1<rp[j])
				  {
					max1=rp[j];
			  		re=j;
				  }
                max[i]+=max1;
		     	rem[i][re]++;
				rp[re]-=di[re];
				if(rp[re]<=0) rp[re]=0;
		    	t--;max1=-1;
			}
		}
		max1=-1;
		for(i=1;i<=n;i++)
		{
			if(max1<max[i])
			{
				max1=max[i];
				re=i;
			}
		}
        for(j=1;j<n;j++)
			printf("%d, ",5*rem[re][j]);
           printf("%d\nNumber of fish expected: %d\n",5*rem[re][n],max1);
		   printf("\n");
	}
	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