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

汗~少了一个空行,PE了一次。留码参考

Posted by 15700764631 at 2016-01-06 21:57:11 on Problem 1484
#include"stdio.h"
void main()
{
	int a[25],b[25];
	int i,n,m,max,c,sum,t=1,l;
	while(scanf("%d%d%d",&n,&m,&c)!=EOF)
	{
		if(n==0&&m==0&&c==0)break;
		sum=0;
		max=0;
		for(i=1;i<=25;i++)
			b[i]=0;
		for(i=1;i<=n;i++)
			scanf("%d",&a[i]);
		while(m--)
		{
			scanf("%d",&l);
			if(b[l]==0)
			{
				b[l]=1;
				sum+=a[l];
				if(max<sum)max=sum;
			}
			else if(b[l]=1)
			{
				b[l]=0;
				sum-=a[l];
			}
		}	
		printf("Sequence %d\n",t++);
		if(sum>c)
			printf("Fuse was blown.\n\n");
		if(sum<=c)
			printf("Fuse was not blown.\nMaximal power consumption was %d amperes.\n\n",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