作者:yunjinqi 类别:
日期:2023-05-29 13:24:35
阅读:461 次 消耗积分:0 分
#include <stdio.h>
int main(){
int target_num,total_trial,count=0;
int my_guess;
if (scanf("%d %d",&target_num,&total_trial)!=0){
//printf("game begins,intput a int number \n");
while (scanf("%d",&my_guess)!=0){
count = count+1;
//printf("%d %d %d %d",target_num,total_trial,my_guess,count);
if (my_guess==target_num && count==1){printf("Bingo!");break;}
if (my_guess==target_num && count<=3){printf("Lucky You!");break;}
if (my_guess==target_num && count>3 && count<=total_trial){printf("Good Guess!");break;}
if (my_guess!=target_num && (count> total_trial || my_guess<0)){printf("Game Over");break;}
if (my_guess>target_num){printf("Too big\n");}
if (my_guess<target_num){printf("Too small\n");}
}
}else{
printf("输入的数据存在错误");
}
return 0;
}