版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/richenyunqi/article/details/86430403
欢迎访问我的CCF认证考试题解目录哦 https://blog.csdn.net/richenyunqi/article/details/83385502
题目描述
C++代码
#include<bits/stdc++.h>
using namespace std;
int main(){
int red,yellow,green,N,a,b,ans=0;
scanf("%d%d%d%d",&red,&yellow,&green,&N);
while(~scanf("%d%d",&a,&b))
if(a==0||a==1)
ans+=b;
else if(a==2)
ans+=b+red;
printf("%d",ans);
return 0;
}