问题描述
题解:
看着题目较复杂,实际读懂题目很简单
#include<bits/stdc++.h>
using namespace std;
int k[105]={0};
int t[105]={0};
int main()
{
int r,y,g;
cin>>r>>y>>g;
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>k[i]>>t[i];
}
int Atime=0;
for(int i=0;i<n;i++)
{
switch(k[i])
{
case 0:
Atime += t[i];
break;
case 1:
Atime += t[i];
break;
case 2:
Atime =Atime+t[i]+r;
break;
}
}
cout<<Atime<<endl;
return 0;
}