提交时间:2021-05-23 10:03:07

运行 ID: 19818

#include<bits/stdc++.h> using namespace std; int n,k,loc; string c; int main(){ scanf("%ld,%ld",&n,&k); cin>>c; loc=c.length()-1; for(int i=0;i<=loc;i++){ switch(c[i]){ case 'a':n*=k,n%=1000; break; case 'b':n+=k,n%=1000; break; case 'c':n=abs(n-k); break; case 'd':n/=k; break; } } cout<<n; return 0; }