PAT 1071小賭怡情(15分)C言語
#include
#include
int main()
{
int T=0,K=0,i=0;
int n1=0,b=0,t=0,n2=0;
scanf("%d%d",&T,&K);
int x = T; //
for(; in1 && b==1)) //
{
x += t;
printf("Win %d! Total = %d.
",t,x);
}
else
{
x -= t; //x 0 , lost game over
printf("Lose %d. Total = %d.
",t,x);
if(x<=0)
{
printf("Game Over.
");
break;
}
}
}
else //
{
printf("Not enough tokens. Total = %d.
",x);
}
}
return 0;
}