提交时间:2021-05-27 20:32:02
运行 ID: 19982
#include<bits/stdc++.h> using namespace std; int main() { // freopen("x12_1.in","r",stdin); // freopen("x12_1.out","w",stdout); int n,k,i; char s[1005],ch; cin>>n>>ch>>k; cin>>s; for(i=0;i<strlen(s);++i){//模拟所有操作 if(s[i]=='a')n=(n*k)%1000; if(s[i]=='b')n=(n+k)%1000; if(s[i]=='c')n=abs(n-k); if(s[i]=='d')n=n/k; } cout<<n; return 0; }