100 288 ABECED 876356 321456 ABECAEDBECAF
388,388 2717080,1519268
#include<iostream> #include<string> using namespace std; int main() { int M1,M2;string str; int R1,R2,R3; while(cin>>M1>>M2) { R1=R2=R3=0; cin>>str; for(int i=0;i<str.size();i++) { switch(str[i]) { case 'A': R1=M1;break; case'B': R2=M2;break; case'C': M1=R3;break; case'D': M2=R3;break; case'E': R3=R1+R2;break; case'F': R3=R1-R2;break; } } cout<<M1<<","<<M2<<endl; } return 0; }
原文地址:http://blog.csdn.net/lsgqjh/article/details/44857615