#include<bits/stdc++.h>
using namespace std;
int main ()
{
srand((int)time(0)); long long c[5],m[5],x[10],ans=0,sum=1;
memset(x,-1,sizeof(x));
while (sum<=4)
{
ans=rand()%10;
if (x[ans]==-1)
{
x[ans]=1;
m[sum]=ans;
sum++;
}
}
cout<<"输入密码"<<endl;
for (long long i=1;i<=10;i++)
{
long long a=0,b=0;
for (long long j=1;j<=4;j++)
{
cin>>c[j];
if (c[j]==m[j])
{
a++;
}else
{
for (long long l=1;l<=4;l++)
{
if (j!=l && c[j]==m[l])
{
b++;
}
}
}
}
cout<<a<<'A'<<" "<<b<<'B'<<endl;
if (a==4)
{
cout<<"看来你并没有我想象中的那么傻";
return 0;
}
}
cout<<"你输了,你个傻瓜!"<<endl;
cout<<"正确答案是:";
for (long long i=1;i<=4;i++)
{
cout<<m[i]<<" ";
}
return 0;}