#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
int n,m,c,t=1;
while(cin>>n>>m>>c&&n!=0&&m!=0&&c!=0){
int ni[n],op[n];
for(int i=0;i<n;i++){
cin>>ni[i];
op[i]=1;
}
int k,ans=0,now=0;
while(m--){
cin>>k;
now+=(ni[k-1]*op[k-1]);
op[k-1]*=-1;
ans=max(ans,now);
}
cout<<"Sequence "<<t<<'\n';
if(ans>c)
cout<<"Fuse was blown.\n";
else
cout<<"Fuse was not blown.\nMaximal power consumption was "<<ans<<" amperes.\n";
cout<<'\n';
t++;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
int n,m,c,t=1;
while(cin>>n>>m>>c&&n!=0&&m!=0&&c!=0){
int ni[n],op[n];
for(int i=0;i<n;i++){
cin>>ni[i];
op[i]=1;
}
int k,ans=0,now=0;
while(m--){
cin>>k;
now+=(ni[k-1]*op[k-1]);
op[k-1]*=-1;
ans=max(ans,now);
}
cout<<"Sequence "<<t<<'\n';
if(ans>c)
cout<<"Fuse was blown.\n";
else
cout<<"Fuse was not blown.\nMaximal power consumption was "<<ans<<" amperes.\n";
cout<<'\n';
t++;
}
return 0;
}
最後一筆測資 ”不用另外換行“~~
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
int n,m,c,t=1;
while(cin>>n>>m>>c&&n!=0&&m!=0&&c!=0){
int ni[n],op[n];
for(int i=0;i<n;i++){
cin>>ni[i];
op[i]=1;
}
int k,ans=0,now=0;
while(m--){
cin>>k;
now+=(ni[k-1]*op[k-1]);
op[k-1]*=-1;
ans=max(ans,now);
}
cout<<"Sequence "<<t<<'\n';
if(ans>c)
cout<<"Fuse was blown.\n";
else
cout<<"Fuse was not blown.\nMaximal power consumption was "<<ans<<" amperes.\n";
cout<<'\n';
t++;
}
return 0;
}
最後一筆測資 ”不用另外換行“~~
不好意思,我想請問一下他要怎麼判斷是最後一筆測資呢??
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
int n,m,c,t=1;
while(cin>>n>>m>>c&&n!=0&&m!=0&&c!=0){
int ni[n],op[n];
for(int i=0;i<n;i++){
cin>>ni[i];
op[i]=1;
}
int k,ans=0,now=0;
while(m--){
cin>>k;
now+=(ni[k-1]*op[k-1]);
op[k-1]*=-1;
ans=max(ans,now);
}
cout<<"Sequence "<<t<<'\n';
if(ans>c)
cout<<"Fuse was blown.\n";
else
cout<<"Fuse was not blown.\nMaximal power consumption was "<<ans<<" amperes.\n";
cout<<'\n';
t++;
}
return 0;
}
最後一筆測資 ”不用另外換行“~~
不好意思,我想請問一下他要怎麼判斷是最後一筆測資呢??
他沒判斷是不是最後一筆測資吧
單純就只是給系統的答案最後一筆沒有換行而已,跟你的答案比對到的時候,你多出了最後一筆的換行。
然後我覺得這樣很煩
沒有最後一筆換行的時候 uva 會 Presentation error zj會過
然後有最後一筆換行的時候 uva 會過 而zj則變成 OLE
就不能統一嗎...