#include"iostream"
using namespace std;
#include"ctime"
#include"cstdlib"
int main()
{
int a;
srand((unsigned)time(0));
a=1+rand()%1000;
cout<<a<<endl;
int z=0;
for(;;)
{
cout<<"请猜数"<<endl;
int b;
cin>>b;
if(a>b)
{
cout<<"小了"<<endl;
z++;
}
else if(a==b)
{
z++;
cout<<"对了,猜了"<<z<<"次";
break;
}
else
{
cout<<"大了";
z++;
}
}
return 0;
}