在这里插入图片描述](https://img-blog.csdnimg.cn/20200412230103317.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjQ5OTU2Mg==,size_16,color_FFFFFF,t_70)
通过笨方法画图的时候发现这是一个循环,龟兔赛跑问题也就解决了。
#include<stdio.h>
int main(){
int n, a, b, y1, y2;
scanf("%d",&n);
a = n % 90;
b = n / 90;
if( a >= 0 && a <= 10 )
y1 = a * 9;
else if( a <= 40 )
y1 = 90;
else if( a <= 50)
y1 = 90 + ( a - 40) * 9;
else if( a <= 80)
y1 = 180;
else y1 = 180 + ( a - 80) * 9;
y2 = n * 3;
y1 = y1 + b * 270;
if( y2 > y1){
printf("@_@ %d", y2);
}
else if( y2 == y1)
printf("-_- %d",y1);
else {
printf("^_^ %d", y1);
}
return 0;
}