CCF 201812-1 小明上学
#include <iostream> #include <bits/stdc++.h> #include <string> using namespace std; int main() { int r,y,g; cin>>r>>y>>g; int n; cin>>n; int sum=0; while(n--) { int k,t; cin>>k>>t; switch (k) { case 0: sum+=t; break; case 1: sum+=t; break; case 2: sum+=(t+r); break; case 3: break; } } cout<<sum<<endl; }