跳到正文

个人记录

名字Rating

yyandy约 7 分钟
原文
文章信息与版本

文章信息

发布
2021年2月11日
收录
2026年7月13日
更新
2026年11月18日
篇幅
约 7 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int x,i,j;
struct D{
	int gong,fang,xue,zhi,ming,mo,score,id;
}f[2000];
string pq[3]={"负","胜"};
double p[60]={1.23,1.76,1.54,1.37,2.22,1.92,1.19,1.32,1.49,1.57,1.86,1.73,1.53,1.97,1.11,1.14,1.51,1.66,1.75,1.88,1.38,1.58,1.62,1.64,1.69
              ,1.79,1.89,1.91,2.03,1.04,1.01,0.94,0.99,2.11,2.04,0.92,1.05,1.27,1.28,2.32,1.19,2.10,1.60,1.30,1.20,1.77,1.16,1.13,1.44,1.65,1.78,1.79};
long long q[20];
int mod=1e9+7;//1e17+3;
int rank[2000];
int pt[2000],k,F,mm,kk,mf[2000],mt[2000];
string st[2000];
bool cmp(D x,D y){
	return x.score>y.score;
}
int nm[20]={13,37,23,127,7,5,3,881,103,107,111,119,141,157};
bool zhan(int x,int y){
	long long re=f[x].mo*f[y].mo+97,ce=f[x].ming*f[y].ming+107,pe=f[x].zhi*f[y].zhi+109;
	int round=0;
	re+=(f[x].xue*f[y].xue+111)%127;
	pe+=(f[y].fang*f[x].fang+114)%127;
	re=rand()%1000+1500;
	ce=rand()%1000+1500;
	pe=rand()%1000+1500;
	int xe1=f[x].xue;
	int xe2=f[y].xue;
	while(1){
		round++;
		if(re%(f[x].ming+f[y].ming)>=f[y].ming){
		xe2-=max(1ll,f[x].gong+re%3-f[y].fang);
		re=re*pe%ce+nm[round%10];re=rand()%1000+1500;
		if(ce%(f[x].mo+f[y].mo)<f[x].mo)
		xe2-=ce%50+50,ce=ce*pe%re+nm[round%10+2],ce=rand()%1000+1500;
		if(pe%(f[x].zhi+f[y].zhi)<f[x].zhi)
		xe1+=f[x].gong%(pe%80+9),pe=ce*re%pe+nm[round%10+3],pe=rand()%1000+1500;
	    }
	    if(xe2<=0)return 1;
		if(re%(f[x].ming+f[y].ming)<f[y].ming){
		xe1-=max(1ll,f[y].gong+re%3-f[y].fang);
		re=re*pe%ce+nm[round%10];re=rand()%1000+1500;
		if(ce%(f[x].mo+f[y].mo)>=f[x].mo)
		xe1-=ce%50+50,ce=ce*pe%re+nm[round%10+2],ce=rand()%1000+1500;
		if(pe%(f[x].zhi+f[y].zhi)>=f[x].zhi)
		xe1+=f[x].gong%(pe%80+9),pe=ce*re%pe+nm[round%10+3],pe=rand()%1000+1500;
	    }
	    if(xe1<=0)return 0;
	}
}
int main(){
	srand(time(0));
	for(x=1;x<=1001;++x){
	 stringstream  temp;  
	 if (x<=1000)
	 {
	 temp<<x;  
	 temp>>st[x];
}
else
cout<<"输入你的名字\n", 
cin>>st[x];
	 f[x].score=200;
	 f[x].id=x;
	k=0;
	F=st[x].length();
	for(i=0;i<=4;++i)/*cout<<q[i]<<" ",*/q[i]=80+st[x][0]*st[x][st[x].length()-1]+F*F;
//	cout<<endl;
	for(i=0;i<st[x].length();++i)
	q[st[x][i]%5]=int(q[st[x][i]%5]*p[st[x][i]%5*10+(++k)%10]+st[x][i])%mod/*,cout<<i<<endl*/;
	f[x].xue=(q[1]%11*(q[1]%257)%97+int(q[2]%127*sqrt(q[3]))%887+F*F+q[0]%107)%229+220;
	f[x].gong=(q[0]%23+77+(q[4]%199)*(q[4]%491)*(q[3]%607)%(int(sqrt(q[2]))+11))%61+43;
	f[x].fang=int(q[4]%29+q[3]%163+sqrt(q[0]))%47+37;
	f[x].ming=(q[1]%31+int(sqrt(q[3]))%881+(q[2]%107)*(q[2]%109))%67+41;
	f[x].mo=(int(sqrt(q[4]))%89+q[2]%(int(sqrt(q[3]))+17))%71+29;
	f[x].zhi=(q[1]%17+q[2]+q[3]%193+q[4]%367+q[0]%443)%59+53;
/*	f[1001].xue=508;
	f[1001].zhi=f[1001].mo=f[1001].ming=f[1001].gong=102;
	f[1001].fang=88;*/

}

while (1){
	kk=0;
	for (int o=1;o<=5;++o)
	{
	for(i=1;i<=1001;++i)
	{
		int fl=0,p=i-rand()%5-1;
	for(j=1;j<=4;++j)
	{
			if(fl==1||f[i].score<=50)break;
		if(p<=0)
		{
			if(i<1001)
		f[i+1].score--,f[i].score++;continue;
	}
	if(zhan(i,p))
	{
	if(f[i].id==1001)
	mf[++kk]=f[p].id,mt[kk]=1;
	if(f[p].id==1001)
	mf[++kk]=f[i].id,mt[kk]=0;
	f[i].score+=i-p,f[p].score-=i-p,p-=rand()%(i-p+1)+1;
}
	else 
	{
	if(f[i].id==1001)
	mf[++kk]=f[p].id,mt[kk]=0;
	if(f[p].id==1001)
	mf[++kk]=f[i].id,mt[kk]=1;
	f[p].score+=4,f[i].score-=4;	fl++;
	if(fl==1||f[i].score<=50)break;
}
	
}
}
sort(f+1,f+1002,cmp);
for(i=1;i<=1001;++i)
if(f[i].id==1001)
mm=i;
}
cout<<"你的"<<st[1001]<<" 名次"<<mm<<endl;
for (i=1;i<=kk;++i)
cout<<"对战"<<mf[i]<<" "<<pq[mt[i]]<<endl;
for (i=1;i<=40;++i)
cout<<"第"<<i<<"名 "<<st[f[i].id]<<" 得分"<<f[i].score/*<<" "<<f[i].xue<<" "<<f[i].gong<<" "<<f[i].fang<<" "<<f[i].zhi<<" "<<f[i].ming<<" "<<f[i].mo*/<<endl;
system("pause");
system("cls");
}
}
原文