Start brushing questions, I feel that the amount of code and the foundation are too scum, resulting in the data structure will not, slowly brush it ~
1. Title
Sample input:
242
Sample output:
@_@ 726
2. Code
#include<stdio.h>
int main(){
int min;
scanf("%d",&min);
int s1=0,s2=0,run=10,rest=-1;
while(min--){
s1+=3;
if(run-->0){
s2+=9;
}
if(run==0){
if(s2>s1&&rest!=0){
rest=30;
}
else{
run=10;
}
}
if(rest--==0){
run=10;
}
}
if(s1>s2){
printf("@_@ %d",s1);
}
else if(s1<s2){
printf("^_^ %d",s2);
}
else{
printf("-_- %d",s2);
}
return 0;
}
3 Discussion
This question is very interesting. You have to find a variable to measure this relationship. The time is indeed better, but the tearing time is not particularly good. Simulate the natural time, so that the process of the turtle-rabbit race can be better written. .
Define two variables, one run
and one rest
, to realize the process of exercise and rest. If it is used up, re-grant it. Every ten minutes after the rabbit runs, you need to verify who is running fast with the turtle. If you are not taking a break at the same time, then rest for 30 minutes. If the break is over, then run for ten minutes.
Wonderful! ! !