5-22 the tortoise and the hare race (20 points), 5-22 the tortoise and the hare race 20 points
The tortoise and the rabbit race against each other. The runway is a rectangular runway, and you can rest anywhere on the side of the runway. The tortoise can move 3 meters every minute, and the hare can move forward 9 meters every minute. The hare thinks that the tortoise is slow and thinks it will certainly win the tortoise. So, every 10 minutes, he looks back at the tortoise, if you find that you have exceeded the tortoise, you can rest on the side of the road for 30 minutes each time. Otherwise, you can continue to run for 10 minutes. The tortoise works very hard, keeps running, and does not rest. Assume that the tortoise and the rabbit start to run at the same time at the same starting point. Who will run fast after T minutes?
Input Format:
Enter the time T (minutes) for the match in one row ).
Output Format:
Output the result of the match in one row: The tortoise wins@_@
, Rabbit win output^_^
, Draw is output-_-
Followed by a space, and then output the distance of the winner.
Input example:
242
Output example:
@_@ 726
1 # include <stdio. h> 2 # include <string. h> 3 4 int main (void) 5 {6 int I, m, flag = 0; 7 int turtle = 0, rabbit = 0; 8 scanf ("% d ", & m); 9 for (I = 0; I <m; I ++) {10 turtle + = 3; 11 // If the rabbit is not resting, and it is faster than turtles every 10 minutes to determine whether to take a rest 12 if (flag = 0 & I % 10 = 0 & rabbit> turtle) {13 flag = 30; // rest for 30 minutes 14} 15 // rest end 16 if (flag = 0) {17 rabbit + = 9; 18} else {// 19 flag in rest --; 20} 21 22} 23 24 char win_s [5]; 25 int win_d; 26 if (rabbit> turtle) {27 strcpy (win_s, "^_^"); 28 win_d = rabbit; 29} else if (rabbit <turtle) {30 strcpy (win_s ,"@_@"); 31 win_d = turtle; 32} else {33 strcpy (win_s, "-_-"); 34 win_d = turtle; 35} 36 printf ("% s % d \ n ", win_s, win_d); 37 return 0; 38}