题目: http://acm.hdu.edu.cn/showproblem.php?pid=1283

 

水题; 我还是不够机智,Wa了一次;

 

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main()
{
    int M1, M2;
     char Qu[202];
    while(~scanf("%d %d", &M1, &M2))
    {
        getchar();
        gets(Qu); 
        int R1 = 0, R2 = 0, R3 = 0;
        int len = strlen(Qu);
        for(int i = 0; i < len; i++)
        {
            if(Qu[i] == 'A')
                R1 = M1;//, M1 = 0;
            if(Qu[i] == 'B')
                R2 = M2;//, M2 = 0;
            if(Qu[i] == 'C')
                M1 = R3;//, R3 = 0;
            if(Qu[i] == 'D')
                M2 = R3;//, R3 = 0;
            if(Qu[i] == 'E'){
                int temp = R1 + R2;
            /*R1 = 0; R2 = 0;*/ R3 = temp; 
            } 
            if(Qu[i] == 'F'){
                int Temp = R1 - R2;
            /*    R1 = 0; R2= 0;*/ R3 = Temp;
            }
        }
        printf("%d,%d\n", M1, M2);
    }
    return 0;    
} 

 

posted on 2015-08-27 16:58  cleverbiger  阅读(193)  评论(0)    收藏  举报