#include<stdio.h>
int main()
{
int happy=0,sad=0,unhappy=0;
int sum=0;
char ch;
while((ch=getchar())!='$')
{
if(sad&&!happy)
{
printf("-");
sad--;
}
else if(unhappy&&!happy)
{
printf("-");
unhappy--;
}
else
{
if(happy)
happy--;
if(ch=='T')
{
sad=2;
sum+=7;
printf("D");
}
else if(ch=='X')
{
unhappy=1;
printf("U");
}
else if(ch=='C')
{
happy=2;
sum-=3;
printf("!");
}
}
}
printf("\n%d",sum);
return 0;
}
选择结构——抓老鼠
最新推荐文章于 2024-08-18 18:02:49 发布