跳到正文

个人记录

me的名竞

mahaoming约 26 分钟
原文
文章信息与版本

文章信息

发布
2023年8月6日
收录
2025年12月12日
更新
2026年11月18日
篇幅
约 26 分钟

版本

  1. v2当前
  2. v1
C++
#include <bits/stdc++.h>
#include <unistd.h>
#include <time.h>
using namespace std;
inline int read(){
	int s=0;
	char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while('0'<=c&&c<='9')s=s*10+c-'0',c=getchar();
	return s;
}
inline void write(int x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
struct st{
	int jn[20];
	int hp;
	int gj;
	int fy;
}a1,a2;
string s1,s2;
int zz1,zz2,jn1,jn2,c=1,jg,n,f,F;
int HP(int x){
	x=x%500;
	if(x<=250)x+=100;
	return x;
}
int HP2(int x){
	x=x*zz1%500;
	if(x<=250)x+=100;
	return x;
}
int HP3(int x){
	x=x*zz2%500;
	if(x<=250)x+=100;
	return x;
}
int GJ(int x){
	x=x%150;
	if(x<=100)x+=100;
	return x;
}
int GJ2(int x){
	x=x*zz1%150;
	if(x<=100)x+=100;
	return x;
}
int GJ3(int x){
	x=x*zz2%150;
	if(x<=100)x+=100;
	return x;
}
int FY(int x){
	x=x%100;
	if(x<=50)x+=50;
	return x;
}
int FY2(int x){
	x=x*zz1%100;
	if(x<=50)x+=50;
	return x;
}
int FY3(int x){
	x=x*zz2%100;
	if(x<=50)x+=50;
	return x;
}
void JN(int x,int y){
	x=(x+zz1)%10+1;
	if(y==1)
		a1.jn[x]=1;
	else
		a2.jn[x]=1;
	return ;
}
void JN2(int x,int y){
	x=(x+zz2)%10+1;
	if(y==1)
		a1.jn[x]=1;
	else
		a2.jn[x]=1;
	return ;
}
string JNzh(int x){
	string S;
	if(x==1)
		S="暴击";
	else if(x==2)
		S="回避攻击";
	else if(x==3)
		S="投毒";
	else if(x==4)
		S="回血";
	else if(x==5)
		S="灼烧";
	else if(x==6)
		S="降维打击";
	else if(x==7)
		S="魅惑";
	else if(x==8)
		S="冰冻";
	else if(x==9)
		S="神剑";
	else if(x==10)
		S="铁壁";
	return S;
}
int main(){
	srand(time(0));
	cout<<"随机种子(*2):"<<endl;
	zz1=read();
	zz2=read();
	cout<<"回合间隔"<<endl;
	jg=read();
	zz1%=50;
	zz2%=50;
	cout<<"是否vs boss(是1否0)";
	f=read();
	if(f){
		cout<<"选择boss"<<endl;
		cout<<"1.Rank1"<<endl;
		cout<<"2._S_B_"<<endl;
		cout<<"3.巨佬_fxt"<<endl;
		cout<<"4.巨佬_wyq"<<endl;
		cout<<"5.巨佬_yzh"<<endl;
		cout<<"6.巨佬_lyh"<<endl;
		cout<<"7.巨佬_Andy_Li"<<endl;
		cout<<"8.巨佬_Sherry"<<endl;
		cout<<"9.巨佬_sheryang"<<endl;
		cout<<"10.sb_jb_kkksc03"<<endl;
		cin>>F;
		if(F==1)
			s2="Rank1+1@1+2@2+3@3+4@4+5@5";
		else if(F==2)
			s2="_S_B_+1@1+2@2+3@3+4@4+5@5";
		else if(F==3)
			s2="巨佬_fxt+1@1+2@2+3@3+4@4+5@5";
		else if(F==4)
			s2="巨佬_wyq+1@1+2@2+3@3+4@4+5@5";
		else if(F==5)
			s2="巨佬_yzh+1@1+2@2+3@3+4@4+5@5";
		else if(F==6)
			s2="巨佬_lyh+1@1+2@2+3@3+4@4+5@5";
		else if(F==7)
			s2="巨佬_Andy_Li+1@1+2@2+3@3+4@4+5@5";
		else if(F==8)
			s2="巨佬_Sherry+1@1+2@2+3@3+4@4+5@5";
		else if(F==9)
			s2="巨佬_sheryang+1@1+2@2+3@3+4@4+5@5";
		else if(F==10)
			s2="sb_jb_kkksc03+1@1+2@2+3@3+4@4+5@5";
		cout<<"对战者的名字:"<<endl;
		cin>>s1;
		cout<<"回合数"<<endl;
		n=read();
		if(s1==s2){
			cout<<"我**********,你**********"<<endl;
			return 0;
		}
		if(s1=="mhm"){
			cout<<s1<<"秒杀了"<<s2;
			return 0;
		}
		if(s2=="mhm"){
			cout<<s2<<"秒杀了"<<s1;
			return 0;
		}
		int l1=s1.size()-1,l2=s2.size()-1;
		for(int i=0;i<=l1;i++){
			if(s1[i]=='+'){
				i++;
				a1.hp=(a1.hp+HP2(s1[i]))%500;
				a1.gj=(a1.gj+GJ2(s1[i]))%150;
				a1.fy=(a1.fy+FY2(s1[i]))%100;
				JN(s1[i],1);
			}
			else if(s1[i]=='@'){
				i++;
				a1.hp=(a1.hp+HP3(s1[i]))%500;
				a1.gj=(a1.gj+GJ3(s1[i]))%150;
				a1.fy=(a1.fy+FY3(s1[i]))%100;
				JN2(s1[i],1);
			}
			else{
				a1.hp=(a1.hp+HP(s1[i]))%500;
				a1.gj=(a1.gj+GJ(s1[i]))%150;
				a1.fy=(a1.fy+FY(s1[i]))%100;
			}
		}
		for(int i=0;i<=l2;i++){
			if(s2[i]=='+'){
				i++;
				a2.hp=(a2.hp+HP2(s2[i]))%500;
				a2.gj=(a2.gj+GJ2(s2[i]))%150;
				a2.fy=(a2.fy+FY2(s2[i]))%100;
				JN(s2[i],1);
			}
			else if(s1[i]=='@'){
				i++;
				a2.hp=(a1.hp+HP3(s2[i]))%500;
				a2.gj=(a1.gj+GJ3(s2[i]))%150;
				a2.fy=(a1.fy+FY3(s2[i]))%100;
				JN2(s2[i],1);
			}
			else{
				a2.hp=(a2.hp+HP(s2[i]))%500;
				a2.gj=(a2.gj+GJ(s2[i]))%150;
				a2.fy=(a2.fy+FY(s2[i]))%100;
			}
		}
		if(F==1)
			s2="Rank1";
		else if(F==2)
			s2="_S_B_";
		else if(F==3)
			s2="巨佬_fxt";
		else if(F==4)
			s2="巨佬_wyq";
		else if(F==5)
			s2="巨佬_yzh";
		else if(F==6)
			s2="巨佬_lyh";
		else if(F==7)
			s2="巨佬_Andy_Li";
		else if(F==8)
			s2="巨佬_Sherry";
		else if(F==9)
			s2="巨佬_sheryang";
		else if(F==10)
			s2="sb_jb_kkksc03";
//		cout<<a1.hp<<endl;
//		cout<<a1.gj<<endl;
//		cout<<a1.fy<<endl;
//		cout<<a2.hp<<endl;
//		cout<<a2.gj<<endl;
//		cout<<a2.fy<<endl;
		if(a1.fy<=0)
			a1.fy=50;
		if(a1.gj<=0)
			a1.gj=50;
		if(a1.hp<=0)
			a1.hp=300;
		if(a2.fy<=0)
			a2.fy=50;
		if(a2.gj<=0)
			a2.gj=50;
		if(a2.hp<=0)
			a2.hp=300;
		a2.fy*=2;
		a2.gj*=2;
		a2.hp*=2;
		while(n){
			bool hbgj1=0,bd1=0,mh1=0,fd1=0;
			bool hbgj2=0,bd2=0,mh2=0,fd2=0;
			cout<<"第";
			write(c);
			cout<<"回合"<<endl;
			cout<<s1<<"  HP:";
			write(a1.hp);
			cout<<"  攻击:";
			write(a1.gj);
			cout<<"  防御:";
			write(a1.fy);
			cout<<endl;
			cout<<s2<<"  HP:";
			write(a2.hp);
			cout<<"  攻击:";
			write(a2.gj);
			cout<<"  防御:";
			write(a2.fy);
			cout<<endl;
			c++,jn1=rand()%15+1;
			if(jn1<=10){
				cout<<s1<<"发动了"<<jn1<<"技能——";
				cout<<JNzh(jn1)<<endl;
				if(jn1==1){
					fd1=1;
					int AA=3*a1.gj-a2.fy*2;
					if(AA<0)AA=0;
					cout<<s2<<"受到了";
					write(AA);
					cout<<"点暴击伤害,HP变为了";
					write(a2.hp-AA);
					cout<<endl;
					a2.hp=a2.hp-AA;
				}
				else if(jn1==2){
					fd1=1;
					cout<<s1<<"回避了攻击"<<endl;
					hbgj1=1;
				}
				else if(jn1==3&&a1.jn[3]==1){
					fd1=1;
					int AA=2*a1.gj-a2.fy;
					if(AA<0)AA=0;
					cout<<s2<<"受到了";
					write(AA);
					cout<<"点毒药伤害,HP变为了";
					write(a2.hp-AA);
					cout<<endl;
					a2.hp=a2.hp-AA;
				}
				else if(jn1==4){
					fd1=1;
					int AA=abs(2*a1.gj-a2.fy);
					cout<<s1<<"回复了";
					write(AA);
					cout<<"点HP,HP变为了";
					write(a1.hp+AA);
					cout<<endl;
					a1.hp=a1.hp+AA;
				}
				else if(jn1==5&&a1.jn[5]==1){
					fd1=1;
					int AA=a1.gj;
					if(AA<0)AA=0;
					cout<<s2<<"受到了";
					write(AA);
					cout<<"点火焰伤害,HP变为了";
					write(a2.hp-AA);
					cout<<endl;
					a2.hp=a2.hp-AA;
				}
				else if(jn1==6&&a1.jn[6]==1){
					fd1=1;
					a2.fy/=2;
					a2.gj/=2;
					a2.hp/=2;
				}
				else if(jn1==9&&a1.jn[9]==1){
					fd1=1;
					a1.gj*=2;
				}
				else if(jn1==10&&a1.jn[10]==1){
					fd1=1;
					a1.fy*=2;
				}
			}
			jn2=rand()%15+1;
			if(jn2<=10){
				cout<<s2<<"发动了"<<jn2<<"技能——";
				cout<<JNzh(jn2)<<endl;
				if(jn2==1){
					fd2=1;
					int AA=3*a2.gj-a1.fy*2;
					if(AA<0)AA=0;
					cout<<s1<<"受到了";
					write(AA);
					cout<<"点暴击伤害,HP变为了";
					write(a1.hp-AA);
					cout<<endl;
					a1.hp=a1.hp-AA;
				}
				else if(jn2==2){
					fd2=1;
					cout<<s2<<"回避了攻击"<<endl;
					hbgj2=1;
				}
				else if(jn2==3&&a2.jn[3]){
					fd2=1;
					int AA=2*a2.gj-a1.fy;
					if(AA<0)AA=0;
					cout<<s1<<"受到了";
					write(AA);
					cout<<"点毒药伤害,HP变为了";
					write(a1.hp-AA);
					cout<<endl;
					a1.hp=a1.hp-AA;
				}
				else if(jn2==4){
					fd2=1;
					int AA=abs(2*a2.gj-a1.fy);
					cout<<s2<<"回复了";
					write(AA);
					cout<<"点HP,HP变为了";
					write(a2.hp+AA);
					cout<<endl;
					a2.hp=a2.hp+AA;
				}
				else if(jn2==5&&a2.jn[5]){
					fd2=1;
					int AA=a2.gj;
					if(AA<0)AA=0;
					cout<<s1<<"受到了";
					write(AA);
					cout<<"点火焰伤害,HP变为了";
					write(a1.hp-AA);
					cout<<endl;
					a1.hp=a1.hp-AA;
				}
				else if(jn2==6&&a2.jn[6]==1){
					fd1=1;
					a1.fy/=2;
					a1.gj/=2;
					a1.hp/=2;
				}
				else if(jn2==9&&a2.jn[9]==1){
					fd2=1;
					a2.gj*=2;
				}
				else if(jn2==10&&a2.jn[10]==1){
					fd2=1;
					a2.fy*=2;
				}
			}
			if(fd1&&hbgj1==1);
			if(fd2&&hbgj2==1);
			if(!fd1&&!hbgj2){
				int AA=a1.gj-a2.fy;
				if(AA<0)AA=0;
				cout<<s2<<"受到了"<<AA;
				cout<<"点伤害,HP变为了";
				cout<<a2.hp-AA<<endl;
				a2.hp=a2.hp-AA;
			}
			if(!fd2&&!hbgj1){
				int AA=a2.gj-a1.fy;
				if(AA<0)AA=0;
				cout<<s1<<"受到了"<<AA;
				cout<<"点伤害,HP变为了";
				cout<<a1.hp-AA<<endl;
				a1.hp=a1.hp-AA;
			}
			n--;
			if(a1.hp<=0||a2.hp<=0)break;
			sleep(jg);
		}
	}
	else{
		cout<<"第一个人的名字:"<<endl;
		cin>>s1;
		cout<<"第二个人的名字:"<<endl;
		cin>>s2;
		cout<<"回合数"<<endl;
		n=read();
		if(s1==s2){
			cout<<"我**********,你**********"<<endl;
			return 0;
		}
		if(s1=="mhm"){
			cout<<s1<<"秒杀了"<<s2;
			return 0;
		}
		if(s2=="mhm"){
			cout<<s2<<"秒杀了"<<s1;
			return 0;
		}
		int l1=s1.size()-1,l2=s2.size()-1;
		for(int i=0;i<=l1;i++){
			if(s1[i]=='+'){
				i++;
				a1.hp=(a1.hp+HP2(s1[i]))%500;
				a1.gj=(a1.gj+GJ2(s1[i]))%150;
				a1.fy=(a1.fy+FY2(s1[i]))%100;
				JN(s1[i],1);
			}
			else if(s1[i]=='@'){
				i++;
				a1.hp=(a1.hp+HP3(s1[i]))%500;
				a1.gj=(a1.gj+GJ3(s1[i]))%150;
				a1.fy=(a1.fy+FY3(s1[i]))%100;
				JN2(s1[i],1);
			}
			else{
				a1.hp=(a1.hp+HP(s1[i]))%500;
				a1.gj=(a1.gj+GJ(s1[i]))%150;
				a1.fy=(a1.fy+FY(s1[i]))%100;
			}
		}
		for(int i=0;i<=l2;i++){
			if(s2[i]=='+'){
				i++;
				a2.hp=(a2.hp+HP2(s2[i]))%500;
				a2.gj=(a2.gj+GJ2(s2[i]))%150;
				a2.fy=(a2.fy+FY2(s2[i]))%100;
				JN(s2[i],1);
			}
			else if(s1[i]=='@'){
				i++;
				a2.hp=(a1.hp+HP3(s2[i]))%500;
				a2.gj=(a1.gj+GJ3(s2[i]))%150;
				a2.fy=(a1.fy+FY3(s2[i]))%100;
				JN2(s2[i],1);
			}
			else{
				a2.hp=(a2.hp+HP(s2[i]))%500;
				a2.gj=(a2.gj+GJ(s2[i]))%150;
				a2.fy=(a2.fy+FY(s2[i]))%100;
			}
		}
//		cout<<a1.hp<<endl;
//		cout<<a1.gj<<endl;
//		cout<<a1.fy<<endl;
//		cout<<a2.hp<<endl;
//		cout<<a2.gj<<endl;
//		cout<<a2.fy<<endl;
		if(a1.fy<=0)
			a1.fy=50;
		if(a1.gj<=0)
			a1.gj=50;
		if(a1.hp<=0)
			a1.hp=300;
		if(a2.fy<=0)
			a2.fy=50;
		if(a2.gj<=0)
			a2.gj=50;
		if(a2.hp<=0)
			a2.hp=300;
		while(n){
			bool hbgj1=0,bd1=0,mh1=0,fd1=0;
			bool hbgj2=0,bd2=0,mh2=0,fd2=0;
			cout<<"第";
			write(c);
			cout<<"回合"<<endl;
			cout<<s1<<"  HP:";
			write(a1.hp);
			cout<<"  攻击:";
			write(a1.gj);
			cout<<"  防御:";
			write(a1.fy);
			cout<<endl;
			cout<<s2<<"  HP:";
			write(a2.hp);
			cout<<"  攻击:";
			write(a2.gj);
			cout<<"  防御:";
			write(a2.fy);
			cout<<endl;
			c++,jn1=rand()%15+1;
			if(jn1<=10){
				cout<<s1<<"发动了"<<jn1<<"技能——";
				cout<<JNzh(jn1)<<endl;
				if(jn1==1){
					fd1=1;
					int AA=3*a1.gj-a2.fy*2;
					if(AA<0)AA=0;
					cout<<s2<<"受到了";
					write(AA);
					cout<<"点暴击伤害,HP变为了";
					write(a2.hp-AA);
					cout<<endl;
					a2.hp=a2.hp-AA;
				}
				else if(jn1==2){
					fd1=1;
					cout<<s1<<"回避了攻击"<<endl;
					hbgj1=1;
				}
				else if(jn1==3&&a1.jn[3]==1){
					fd1=1;
					int AA=2*a1.gj-a2.fy;
					if(AA<0)AA=0;
					cout<<s2<<"受到了";
					write(AA);
					cout<<"点毒药伤害,HP变为了";
					write(a2.hp-AA);
					cout<<endl;
					a2.hp=a2.hp-AA;
				}
				else if(jn1==4){
					fd1=1;
					int AA=abs(2*a1.gj-a2.fy);
					cout<<s1<<"回复了";
					write(AA);
					cout<<"点HP,HP变为了";
					write(a1.hp+AA);
					cout<<endl;
					a1.hp=a1.hp+AA;
				}
				else if(jn1==5&&a1.jn[5]==1){
					fd1=1;
					int AA=a1.gj;
					if(AA<0)AA=0;
					cout<<s2<<"受到了";
					write(AA);
					cout<<"点火焰伤害,HP变为了";
					write(a2.hp-AA);
					cout<<endl;
					a2.hp=a2.hp-AA;
				}
				else if(jn1==6&&a1.jn[6]==1){
					fd1=1;
					a2.fy/=2;
					a2.gj/=2;
					a2.hp/=2;
				}
				else if(jn1==9&&a1.jn[9]==1){
					fd1=1;
					a1.gj*=2;
				}
				else if(jn1==10&&a1.jn[10]==1){
					fd1=1;
					a1.fy*=2;
				}
			}
			jn2=rand()%15+1;
			if(jn2<=10){
				cout<<s2<<"发动了"<<jn2<<"技能——";
				cout<<JNzh(jn2)<<endl;
				if(jn2==1){
					fd2=1;
					int AA=3*a2.gj-a1.fy*2;
					if(AA<0)AA=0;
					cout<<s1<<"受到了";
					write(AA);
					cout<<"点暴击伤害,HP变为了";
					write(a1.hp-AA);
					cout<<endl;
					a1.hp=a1.hp-AA;
				}
				else if(jn2==2){
					fd2=1;
					cout<<s2<<"回避了攻击"<<endl;
					hbgj2=1;
				}
				else if(jn2==3&&a2.jn[3]){
					fd2=1;
					int AA=2*a2.gj-a1.fy;
					if(AA<0)AA=0;
					cout<<s1<<"受到了";
					write(AA);
					cout<<"点毒药伤害,HP变为了";
					write(a1.hp-AA);
					cout<<endl;
					a1.hp=a1.hp-AA;
				}
				else if(jn2==4){
					fd2=1;
					int AA=abs(2*a2.gj-a1.fy);
					cout<<s2<<"回复了";
					write(AA);
					cout<<"点HP,HP变为了";
					write(a2.hp+AA);
					cout<<endl;
					a2.hp=a2.hp+AA;
				}
				else if(jn2==5&&a2.jn[5]){
					fd2=1;
					int AA=a2.gj;
					if(AA<0)AA=0;
					cout<<s1<<"受到了";
					write(AA);
					cout<<"点火焰伤害,HP变为了";
					write(a1.hp-AA);
					cout<<endl;
					a1.hp=a1.hp-AA;
				}
				else if(jn2==6&&a2.jn[6]==1){
					fd1=1;
					a1.fy/=2;
					a1.gj/=2;
					a1.hp/=2;
				}
				else if(jn2==9&&a2.jn[9]==1){
					fd2=1;
					a2.gj*=2;
				}
				else if(jn2==10&&a2.jn[10]==1){
					fd2=1;
					a2.fy*=2;
				}
			}
			if(fd1&&hbgj1==1);
			if(fd2&&hbgj2==1);
			if(!fd1&&!hbgj2){
				int AA=a1.gj-a2.fy;
				if(AA<0)AA=0;
				cout<<s2<<"受到了"<<AA;
				cout<<"点伤害,HP变为了";
				cout<<a2.hp-AA<<endl;
				a2.hp=a2.hp-AA;
			}
			if(!fd2&&!hbgj1){
				int AA=a2.gj-a1.fy;
				if(AA<0)AA=0;
				cout<<s1<<"受到了"<<AA;
				cout<<"点伤害,HP变为了";
				cout<<a1.hp-AA<<endl;
				a1.hp=a1.hp-AA;
			}
			n--;
			if(a1.hp<=0||a2.hp<=0)break;
			sleep(jg);
		}
	}
	cout<<c-1<<"回合后:"<<endl;
	if((a1.hp<=0&&a2.hp<=0)||a1.hp==a2.hp)
		cout<<s1<<"&"<<s2<<"平局";
	else if(a1.hp<=0)
		cout<<s2<<"胜利并击杀了"<<s1;
	else if(a2.hp<=0)
		cout<<s1<<"胜利并击杀了"<<s2;
	else if(a1.hp<a2.hp)
		cout<<s2<<"胜利"<<endl<<s1<<"失败";
	else if(a1.hp>a2.hp)
		cout<<s1<<"胜利"<<endl<<s2<<"失败";
	else
		cout<<"Unknow Error";
	return 0;
}

原文
存档评论2 条抓取于