#include<stdio.h>
#include<string.h>
int main(){
int M1,M2,R1,R2,R3,t,i;
char str[201];
while(scanf("%d%d",&M1,&M2)!=EOF){
R1=R2=R3=0;
getchar();
scanf("%s",str);
t=strlen(str);
for(i=0;i<t;i++){
if(str[i]=='A')
R1=M1;
else if(str[i]=='B')
R2=M2;
else if(str[i]=='C')
M1=R3;
else if(str[i]=='D')
M2=R3;
else if(str[i]=='E')
R3=R1+R2;
else
R3=R1-R2;
}
printf("%d,%d\n",M1,M2);
}
return 0;
}
1283 最简单的计算机
最新推荐文章于 2022-02-25 19:38:17 发布