跳到正文

剪贴板

剪贴板 ejpp4u8s

原文
剪贴板信息

剪贴板信息

收录
更新

最底下有惊喜~

C++
#include<bits/stdc++.h>
using namespace std;
int n,AI;
int sum=0;
void pands(int n){
	if(n==1){
		cout<<"平局"<<endl;
		pands(rand()%3+1);
	}
	else if(n==2){
		cout<<"你输了!"<<endl;
		return;
	}
	else{
		cout<<"你赢了!"<<endl;
		sum++;
		return;
	}
}
void pandj(int n){
	if(n==2){
		cout<<"平局"<<endl;
		pandj(rand()%3+1);
	}
	else if(n==3){
		cout<<"你输了!"<<endl;
		return;
	}
	else{
		cout<<"你赢了!"<<endl;
		sum++;
		return;
	}
}
void pandb(int n){
	if(n==3){
		cout<<"平局"<<endl;
		pandb(rand()%3+1);
	}
	else if(n==1){
		cout<<"你输了!"<<endl;
		return;
	}
	else{
		cout<<"你赢了!"<<endl;
		sum++;
		return;
	}
}
int main()
{
	//AI:石头为1,剪刀为2,布为3。
	srand(time(0));
	cout<<"石头剪刀布"<<endl;
	cout<<"选择模式:"<<endl;
	cout<<"1.一局定胜负"<<endl;
	cout<<"2.三局两胜"<<endl;
	cin>>n;
	if(n==1){
		cout<<"输入你要出的拳:";
		string s;
		cin>>s;
		int sdf=rand()%3+1;
		if(s=="石头"){
			pands(sdf);
		}
		else if(s=="剪刀"){
			pandj(sdf);
		}
		else if(s=="布"){
			pandb(sdf);
		}else{
			cout<<"你违反了规则!!!";
			return 0;
		}
	}
	else if(n==2){
		for(int i=1;i<=3;i++){
			cout<<"输入你要出的拳:";
			string s;
			cin>>s;
			int sdf=rand()%3+1;
			if(s=="石头"){
				pands(sdf);
			}
			else if(s=="剪刀"){
				pandj(sdf);
			}
			else if(s=="布"){
				pandb(sdf);
			}else{
				cout<<"你违反了规则!!!";
				return 0;
			}
		}
		if(sum>=2) cout<<"你打败了AI!!!";
		else cout<<"GAME OVER";
	}
	else{
		cout<<"听话!!!好吗!!!";
		return 0;
	}

	return 0;
}
C++
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
int n,ans=1000,xl=150,dl=250,sjs,sjs2,js,zds,swp=0;
int n1,shl,yanw,shang,yil;
int a[10]={3000,5000,10000,25000,50000,150000,200000,350000,800000,1000000};
int gj[10]={5,10,15,20,21,25,28,30,32,35};
int level,unistd;
void mains(){
	srand(time(0));
	cout<<"CS大赛"<<endl;
	cout<<"请选择你的武器"<<endl;
	cout<<"你的初始资金为:$1000"<<endl;
	int rz=rand()%500+100;
	cout<<"开局奖励:"<<rz<<"元"<<endl;
	ans+=rz;
	cout<<"进入道具商店"<<endl;
	sleep(2);
	system("cls");
	cout<<"1.手雷 $50一个  2.烟雾弹  $30一个  3.闪光弹  $20一个  4.医疗包  $80一个"<<endl;
	cout<<"请输入购买种类:"<<endl;
	int nsum;
	cin>>nsum;
	while(nsum--){
		int n,sums;
		cin>>n>>sums;
		if(n==1){
			ans-=50*sums;
			shl+=sums;
		}
		else if(n==2){
			ans-=30*sums;
			yanw+=sums;
		}
		else if(n==3){
			ans-=20*sums;
			shang+=sums;
		}
		else if(n==4){
			ans-=80*sums;
			yil+=sums;
		}
	}
	cout<<"1.AK47  价格:$100"<<endl;
	cout<<"2.AWM狙击枪  价格:$500"<<endl;
	cout<<"3.M240轻机枪  价格:$600"<<endl;
	cout<<"4.AT-4导弹发射器  价格: $900"<<endl;
	cout<<"注:子弹单价10-20元"<<endl;
	cin>>n;
	if(n==1){
		bool cmp=true,flag=true;
		while(xl>0&&dl>0){
			if(ans<=20){
				cout<<"资金耗尽,GAME OVER,但……"<<endl;
				break;
			}
			ans-=100;
			sjs=rand()%50+1;
			cout<<"造成伤害"<<sjs+gj[level]<<"点"<<endl;
			dl-=sjs;
			zds++;
			ans-=10;
			sjs2=rand()%3+1;
			if(sjs2==2){
				cout<<"连击! 伤害"<<sjs*2<<"点"<<endl;
				dl-=sjs*2;
				zds++;
				ans-=10;
			}
			else if(sjs2==1){
				cout<<"但敌方格挡了本次攻击"<<endl;
				dl+=sjs;
			}
			cout<<"敌方开始攻击……"<<endl;
			if(cmp){
				int dfg=rand()%4+1;
				if(dfg!=2){
					int s=rand()%10+1;
					if(flag==false){
						sjs-=(rand()%15+5);
						flag=true;
					}
					cout<<"遭受到"<<sjs+s<<"伤害"<<endl;
					xl-=(sjs+s);
				}
				else{
					cout<<"对方攻击打空"<<endl;
					cout<<"正在包扎"<<endl;
					xl+=35;
				}
			}
			else{
				cout<<"敌军被烟雾弹阻挡"<<endl;
				cmp=true;
			}
			int xw,fire;
			if(shl>0){
				cout<<"是否使用手雷?是1/否2"<<endl;
				cin>>xw;
				if(xw==1){
					sleep(1);
					int duizhao=rand()%3+1;
					cout<<"投掷!!!(1-3)"<<endl;
					cin>>fire;
					if(fire==duizhao){
						cout<<"伤害40点"<<endl;
						dl-=40;
					}
					else cout<<"伤害20点"<<endl;dl-=20;
				}
				shl--;
			}
			if(xl<=100&&yil>=1){
				cout<<"正在使用医疗包……"<<endl;
				xl+=40;
				yil--;
			}
			if(yanw>=1){
				int yw;
				cout<<"是否使用烟雾弹?是1/否2"<<endl;
				cin>>yw;
				if(yw==1){
					cmp=false;
					yanw--;
				}
			}
			if(shang>=1){
				flag=false;
				shang--;
			}
			cout<<"我方剩余血量:"<<xl<<endl;
			cout<<"敌方剩余血量:"<<dl<<endl;
			sleep(2);
			cout<<endl;
			js++;
		}
		if(dl<=0){
			cout<<"你赢了!"<<endl;
		}
		else{
			cout<<"GAME OVER"<<endl;
		}
	}
	else if(n==2){
		dl=350;
		ans-=500;
		bool cmp=true,flag=true;
		while(xl>0&&dl>0){
			if(ans<=20){
				cout<<"资金耗尽,GAME OVER,但……"<<endl;
				break;
			}
			sjs=rand()%80+1;
			cout<<"造成伤害"<<sjs+gj[level]<<"点"<<endl;
			int randsara=rand()%5+1;
			if(level>=5&&randsara==3){
				cout<<"发动Sara homework技能!!"<<endl;
				dl-=60;
			}
			dl-=sjs;
			zds++;
			ans-=20;
			sjs2=rand()%5+1;
			if(sjs2==2){
				cout<<"穿透打击! 伤害"<<sjs*3<<"点"<<endl;
				dl-=sjs*3;
				zds+=2;
				ans-=40;
			}
			else if(sjs2==1||sjs2==3){
				cout<<"但敌方格挡了本次攻击"<<endl;
				dl+=sjs;
			}
			cout<<"敌方开始攻击……"<<endl;
			int dfg=rand()%4+1;
			if(cmp){
				if(dfg!=2&dfg!=3){
					int s=rand()%10+1;
					if(flag==false){
						sjs-=(rand()%15+5);
						flag=true;
					}
					cout<<"遭受到"<<sjs+s<<"伤害"<<endl;
					xl-=(sjs+s);
				}
				else if(dfg==3){
					int s=rand()%20+1;
					if(flag==false){
						sjs-=(rand()%15+5);
						flag=true;
					}
					cout<<"被换弹时反杀!"<<"遭受到"<<sjs+s<<"伤害"<<endl;
					xl-=(sjs+s);
					cout<<"敌方回血10点"<<endl;
					dl+=10;
				}
				else{
					cout<<"对方攻击打空"<<endl;
					cout<<"正在包扎"<<endl;
					xl+=40;
				}
			}
			else{
				cout<<"敌军被烟雾弹阻挡"<<endl;
				cmp=true;
			}
			int xw,fire;
			if(shl>0){
				cout<<"是否使用手雷?是1/否2"<<endl;
				cin>>xw;
				if(xw==1){
					sleep(1);
					int duizhao=rand()%3+1;
					cout<<"投掷!!!(1-3)"<<endl;
					cin>>fire;
					if(fire==duizhao){
						cout<<"伤害40点"<<endl;
						dl-=40;
					}
					else cout<<"伤害20点"<<endl;dl-=20;
				}
				shl--;
			}
			if(xl<=100&&yil>=1){
				cout<<"正在使用医疗包……"<<endl;
				xl+=40;
				yil--;
			}
			if(yanw>=1){
				int yw;
				cout<<"是否使用烟雾弹?是1/否2"<<endl;
				cin>>yw;
				if(yw==1){
					cmp=false;
					yanw--;
				}
			}
			if(shang>=1){
				flag=false;
				shang--;
			}
			cout<<"我方剩余血量:"<<xl<<endl;
			cout<<"敌方剩余血量:"<<dl<<endl;
			sleep(2);
			cout<<endl;
			js++;
		}
		if(dl<=0){
			cout<<"你赢了!"<<endl;
		}
		else{
			cout<<"GAME OVER"<<endl;
		}
	}
	else if(n==3){
		bool cmp=true,flag=true;
		bool vis=false;
		dl=350;
		xl=150;
		ans-=600;
		while(xl>0&&dl>0){
			int sjs=rand()%5+2;
			for(int i=1;i<=sjs;i++){
				sjs=rand()%25+1;
				if(ans<7){
					cout<<"资金耗尽,GAME OVER,但……"<<endl;
					vis=true;
					break;
				}
				cout<<"造成伤害"<<sjs+gj[level]<<"点"<<endl;
				dl-=sjs;
				sjs2=rand()%5+1;
				if(sjs2==1||sjs2==3){
					cout<<"敌方格挡了本次攻击"<<endl;
					dl+=sjs;
				}
				ans-=7;
				zds++;
			}
			if(vis) break;
			cout<<"敌方开始攻击……"<<endl;
			if(cmp){
				int dfg=rand()%4+1;
				if(dfg!=2&&dfg!=3){
					int s=rand()%60+1;
					if(flag==false){
						sjs-=(rand()%15+5);
						flag=true;
					}
					cout<<"遭受到"<<s<<"伤害"<<endl;
					xl-=s;
				}
				else if(dfg==3){
					cout<<"敌方正在包扎:回血25点"<<endl;
					dl+=25;
				}
				else{
					cout<<"对方攻击打空"<<endl;
					cout<<"正在包扎"<<endl;
					xl+=40;
				}
			}
			else{
				cout<<"敌军被烟雾弹阻挡"<<endl;
				cmp=true;
			}
			int xw,fire;
			if(shl>0){
				cout<<"是否使用手雷?是1/否2"<<endl;
				cin>>xw;
				if(xw==1){
					sleep(1);
					int duizhao=rand()%3+1;
					cout<<"投掷!!!(1-3)"<<endl;
					cin>>fire;
					if(fire==duizhao){
						cout<<"伤害40点"<<endl;
						dl-=40;
					}
					else cout<<"伤害20点"<<endl;dl-=20;
				}
				shl--;
			}
			if(xl<=100&&yil>=1){
				cout<<"正在使用医疗包……"<<endl;
				xl+=40;
				yil--;
			}
			if(yanw>=1){
				int yw;
				cout<<"是否使用烟雾弹?是1/否2"<<endl;
				cin>>yw;
				if(yw==1){
					cmp=false;
					yanw--;
				}
			}
			if(shang>=1){
				flag=false;
				shang--;
			}
			cout<<"我方剩余血量:"<<xl<<endl;
			cout<<"敌方剩余血量:"<<dl<<endl;
			sleep(2);
			cout<<endl;
			js++;
		}
		if(dl<=0){
			cout<<"你赢了!"<<endl;
		}
		else{
			cout<<"GAME OVER"<<endl;
		}
	}
	else if(n==4){
		bool cmp=true,flag=true;
		xl=150;dl=600;
		ans-=900;
		while(xl>0&&dl>0){
			if(ans<=40){
				cout<<"资金耗尽,GAME OVER,但……"<<endl;
				break;
			}
			sjs=rand()%150+60;
			cout<<"正在瞄准……"<<endl;
			int randm=rand()%5+1;
			for(int i=1;i<=5;i++){
				cout<<i<<" ";
				sleep(1);
				if(i==randm){
					cout<<"已锁定!!!发射!"<<endl;
					break;
				}
			}
			cout<<"飞行中……"<<endl;
			cout<<"校准:(1-3)";
			int deepseek=rand()%3+1,jiaoz;
			cin>>jiaoz;
			if(jiaoz==deepseek) sjs+=30;
			sleep(1.5);
			int randj=rand()%3+1,randb=rand()%3+1;
			if(randj==randb){
				cout<<"精准打击!造成伤害"<<sjs+40+gj[level]<<"点"<<endl;
				dl-=sjs+40;
			}
			else{
				cout<<"造成伤害"<<sjs<<"点"<<endl;
				dl-=sjs;
			}
			zds++;
			ans-=40;
			sjs2=rand()%8+1;
			if(sjs2==1){
				cout<<"但敌方格挡了本次攻击"<<endl;
				dl+=sjs;
			}
			cout<<"敌方开始攻击……"<<endl;
			if(cmp){
				int dfg=rand()%4+1;
				int sjs4=rand()%100+1;
				if(dfg!=2){
					int s=rand()%10+1;
					if(flag==false){
						sjs4-=(rand()%15+5);
						flag=true;
					}
					cout<<"遭受到"<<sjs4<<"伤害"<<endl;
					xl-=(sjs4);
				}
				else{
					cout<<"对方攻击打空"<<endl;
					cout<<"正在包扎"<<endl;
					xl+=35;
				}
			}
			else{
				cout<<"敌军被烟雾弹阻挡"<<endl;
				cmp=true;
			}
			int xw,fire;
			if(shl>0){
				cout<<"是否使用手雷?是1/否2"<<endl;
				cin>>xw;
				if(xw==1){
					sleep(1);
					int duizhao=rand()%3+1;
					cout<<"投掷!!!(1-3)"<<endl;
					cin>>fire;
					if(fire==duizhao){
						cout<<"伤害40点"<<endl;
						dl-=40;
					}
					else cout<<"伤害20点"<<endl;dl-=20;
				}
				shl--;
			}
			if(xl<=100&&yil>=1){
				cout<<"正在使用医疗包……"<<endl;
				xl+=40;
				yil--;
			}
			if(yanw>=1){
				int yw;
				cout<<"是否使用烟雾弹?是1/否2"<<endl;
				cin>>yw;
				if(yw==1){
					cmp=false;
					yanw--;
				}
			}
			if(shang>=1){
				flag=false;
				shang--;
			}
			cout<<"我方剩余血量:"<<xl<<endl;
			cout<<"敌方剩余血量:"<<dl<<endl;
			sleep(2);
			cout<<endl;
			js++;
		}
		if(dl<=0){
			cout<<"你赢了!"<<endl;
		}
		else{
			cout<<"GAME OVER"<<endl;
		}
	}
	cout<<endl;
	cout<<"          结算"<<endl;
	cout<<"局数:"<<js<<endl;
	cout<<"消耗子弹:"<<zds<<endl;
	if(dl<=0){
		cout<<"分数:"<<1500-zds*5+js*10+(xl-dl)<<endl;
		swp=1500-zds*5+js*10+(xl-dl);
	}
	else{
		cout<<"分数:"<<800-zds*3+js*15+(dl-xl)<<endl;
		swp=800-zds*3+js*15+(dl-xl);
	}
	cout<<"剩余资金数:"<<ans<<endl;
}
int main()
{
    std::ifstream file("附件.in");
    std::string line;
    while(getline(file,line)){
        std::cout<<line<<std::endl;
        if(line[5]==':') level=(int)line[6]-48;
        else if(line[18]==':') unistd=(int)(line[19]-48)*1000+(line[20]-48)*100+(line[21]-48)*10+(line[22]-48);
    }
    file.close();
    sleep(5);
    system("cls");
	mains();
	if(swp>=unistd){
		level++;
		unistd=a[level]-(swp-unistd);
	}
	else unistd-=swp;
	freopen("附件.in","w",stdout);
	cout<<"level:"<<level<<endl;
	cout<<"upgrade experience:"<<unistd;
	fclose(stdout);

	return 0;
}

附件下载处