SP10401 ALIEN - Aliens at the train
Thank you very much for reading this article.
I am a beginner.I have encountered difficulties in this problem.
This is my code. Who can tell me how to modify it.
Be deeply grateful.
#include<bits/stdc++.h>
using namespace std;
int t,at,bt,atith,peo,sta;
int main(){
cin>>t;
if(t==0){
return 0;
}
for(int i=1;i<=t;i++){
cin>>at>>bt;
for(int j=1;j<=at;j++){
cin>>atith;
peo+=atith;
sta++;
if(peo>=bt){
cout<<peo-atith<<" "<<sta-1<<endl;
break;
}
}
}
return 0;
}