#include <stdio.h>
int main()
{
int turtle=0,rabbit=0;
int run=10,rest=-1,minute;
scanf("%d",&minute);
while (minute--)
{
turtle+=3;
if (run-->0)
{
rabbit+=9;
}
if (run==0)
{
if (rabbit>turtle)
{
rest=30;
}
else
run=10;
}
if (rest--==0)
run=10;
}
printf("%d %d\n",rabbit,turtle);
if (rabbit>turtle)
printf("rabbit win!\n");
else if (rabbit<turtle)
printf("turtle win!\n");
else
printf("two winners\n");
}
原文:https://www.cnblogs.com/DEAKY/p/11914900.html