#include <cstdio>
#include <cstdlib>
#include <ctime>

int main(){
	int ans,n,st,end,times=0;
	bool z=false;
	
	
	st=1;
	end=1000;
	srand(time(0));
	ans=1+rand()%end;
	
	do{
		times=times+1;
		printf("Round %d\n",times);
		do{
			printf("Enter a number between %d and %d:\n",st,end);
			scanf("%d",&n);
			if (n>end || n<st) printf("Range error!!\n");
		}while (n>end || n<st);
		
		if (n>ans) end=n-1;
		else if (n<ans) st=n+1;
	}while (ans!=n);
	
	printf("Congratulations!! You guess the right number in %d times\n",times);
	
	int pause;
	scanf("%d",&pause);
	return 0;
}

