CSP-201812-1-小明上学
解题思路
#include <iostream>
using namespace std;
int main()
{
int red, yellow, green, n, timeSum = 0;
cin >> red >> yellow >> green;
cin >> n;
for (int i = 0; i < n; i++)
{
int flag, time;
cin >> flag >> time;
if (flag == 0)
{
timeSum += time;
}
else if (flag == 1)
{
timeSum += time;
}
else if (flag == 2)
{
timeSum += (time + red);
}
else if (flag == 3)
{
timeSum += 0;
}
}
cout << timeSum;
return 0;
}