[恢]hdu 1283

2011-12-17 07:35:12

地址:http://acm.hdu.edu.cn/showproblem.php?pid=1283

题意:中文。模拟题。

代码:

# include <stdio.h>


char str[1010] ;
int r1, r2, r3 ;
int m1, m2 ;


void handle()
{
int i ;
r1 = r2 = r3 = 0 ;
for (i = 0 ; str[i] ; 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 ;
}
}
}


int main ()
{
while (~scanf ("%d %d%*c", &m1, &m2))
{
scanf ("%s%*c", str) ;
handle() ;
printf ("%d,%d\n", m1, m2) ;
}
return 0 ;
}



posted @ 2012-01-06 22:13  Seraph2012  阅读(114)  评论(0编辑  收藏  举报