| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
大神给看看为什么提交就WA#include<iostream>
#include<string>
using namespace std;
int main()
{
int a,b,c,machine[100000],swith[100000],j,i,s;
int sum;
int count=0;
int max;
while(cin>>a>>b>>c)
{
max=0;
count++;
sum=0;
memset(swith,0,sizeof(swith));
if(a==0&&b==0&&c==0)
break;
for( i=1;i<=a;i++)
{
cin>>machine[i];
}
for(int j=1;j<=b;j++)
{
cin>>s;
if(swith[s]==0)
{
swith[s]=1;
sum+=machine[s];
if(sum>c)
break;
if(max<sum)
max=sum;
}
else
{
swith[s]=0;
sum-=machine[s];
}
}
if(sum>c)
{
cout<<"Sequence "<<count<<endl;
cout<<"Fuse was blown."<<endl<<endl;
}
else
{
cout<<"Sequence "<<count<<endl;
cout<<"Fuse was not blown."<<endl;
cout<<"Maximal power consumption was "<<max<<" amperes."<<endl<<endl;
}
}
system("pause");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator