mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
28 lines
613 B
C++
28 lines
613 B
C++
#include<iostream>
|
|
#include<string>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int m1,m2;
|
|
string str;
|
|
while(cin>>m1>>m2>>str)
|
|
{
|
|
int r1,r2,r3;
|
|
r1=r2=r3=0;
|
|
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;
|
|
}
|