真的自己写的!
2024-10-07 20:45:20
发布于:上海
9阅读
0回复
0点赞
#include<iostream>
using namespace std;
int main(){
int n,l,r;
cin >> n >> l >> r;
char sign[n];
int number[n];
for(int i = 0;i < n;i++) cin >> sign[i] >> number[i];
int q;
cin >> q;
while(q--){
int x;
cin >> x;
long result = x;
for(int i = 0;i < n;i++){
if(sign[i] == '+') result += number[i];
else if(sign[i] == '-') result -= number[i];
else if(sign[i] == '*') result *= number[i];
else if(sign[i] == '@') result += number[i] * x;
if(result > r)result = r;
else if(result < l)result = l;
}
cout << result << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个