#include<iostream>
using namespace std;
class T
{
public:
int _k, _t;
public:
friend istream& operator>>(istream& is, T &t)
{
is >> t._k >> t._t;
return is;
}
};
int main()
{
int r, y, g;
cin >> r >> y >> g;
int n;
cin >> n;
T *array = new T[n];
int sum = 0;
for (int i = 0; i < n; i++)
{
cin >> array[i];
if (array[i]._k == 0 || array[i]._k == 1)
sum += array[i]._t;
else if (array[i]._k == 2)
sum = sum + (array[i]._t + r);
}
cout << sum << endl;
delete[]array;
return 0;
}
CSP 201812-1 小明上学
最新推荐文章于 2024-08-13 08:28:10 发布