CCF-CSP-2018-12-1小明上学
链接:http://118.190.20.162/view.page?gpid=T80
代码:
#include<bits/stdc++.h>
using namespace std;
int main (){
ios::sync_with_stdio(false);
int r,y,g,n;
cin>>r>>y>>g;
cin>>n;
long long ans=0;
int atm,t;
for(int i=0;i<n;i++){
cin>>atm>>t;
if(atm==0||atm==1)ans+=t;
else if(atm==2)ans+=(r+t);
//cout<<ans<<endl;
}
cout<<ans;
return 0;
}
/*
30 3 30
8
0 10
1 5
0 11
2 2
0 6
0 3
3 10
0 3
*/