跳到正文

hjchenyr

2037870

你在末地的虚空里咆哮了千万次又怎样,今天我带着满背包的床,就要把你龙翼下的王座,炸成满地能捡的经验星。---对抗BOSS

这是 2026年10月28日 存档的第 2 版,不是当前版本。查看当前版本

资料、奖项与版本
快读快输
C++
int read()
{
    int k=0,f=1;
    char c=getchar();
    while (c<'0'||c>'9')
    {
        if(c=='-')f=-1;
        c=getchar();
    }
    while (c>='0'&&c<='9') k=k*10+c-'0',c=getchar();
    return k*f;
}
void print(int x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) putchar(x+'0');
    else print(x/10),putchar(x%10+'0');
}
快读快输空格
C++
int read (){
    int k = 0 , f = 1;
    char c = getchar ();
    while (c < '0' || c > '9')
    {
        if (c == '-') f = -1;
        c = getchar ();
    }
    while (c >= '0' && c<='9') k = k * 10 + c - '0' , c = getchar ();
    return k * f;
}

void print (int x){
    if (x <0) putchar ('-') , x =-x;
    if (x < 10) putchar (x + '0');
    else print(x / 10) , putchar(x % 10 + '0');
}
py优化
Python
import sys
sys.set_int_max_str_digits(1000000000)
头文件
C++
#include<bits/stdc++.h>

using namespace std;

int main()
{

}
数据
game
my
C++
#include <bits/stdc++.h>
#include <windows.h> 
using namespace std;
queue<int> q;
int zs,zs1,xs,xm,s;
void out(string s){
	for(int i=0;i<s.size();i++){
		cout<<s[i];Sleep(20);
	}
	//cout<<'\n';
}
void cz(){
	zs=zs1=0; 
	int zd=rand()%10;
	zd++;
	for(int i=1;i<=zd;i++){
		int k=rand()%2;
		if(k==1)q.push(1),zs++;//真 
		else q.push(0),zs1++;//假 
	}
}
void kd(){out("欢迎来到恶魔轮盘赌");cout<<'\n';out("你和恶魔的血量都是5点");cout<<'\n';out("游戏开始");cout<<'\n';}
void xue(int x){
	int f=q.front();
	q.pop();
	if(f==1){
		out("是真弹");cout<<'\n'; 
		if(x==1)xs--;
		else xm--;
		zs--;
	}
	else {
		out("是假弹");cout<<'\n';
		zs1--;
	}
}
int main(){
	srand(time(0));
	kd();
	cz();
	xs=5,xm=5;
	while(!(xs==0||xm==0)){
		s++;
		while(q.empty()==1){
			out("子弹没了,重新填充");cout<<'\n'; 
			cz();
		}
		out("子弹真:");cout<<zs<<'\n';
		out("子弹假:");cout<<zs1<<'\n';
		out("恶魔:");cout<<xm<<'\n';
		out("player:");cout<<xs<<'\n';
		
		while(s%2==0){
			while(q.empty()==1){
				out("子弹没了,重新填充");cout<<'\n'; 
				cz();
			}
			if(xs==0){
				out("你死了");return 0;
			}
			if(xm==0){
				out("恶魔死了");return 0;
			} 
			if(zs>zs1){
				out("恶魔向你开枪");cout<<'\n';
				xue(1);//player是1
				out("继续");cout<<'\n'; 
				break;
			}
			else{
				out("恶魔向自己开枪");xue(2);cout<<'\n'; 
			}
			out("继续");cout<<'\n'; 
		}
		while(s%2==1){
			if(xs==0){
				out("你死了");return 0;
			}
			if(xm==0){
				out("恶魔死了");return 0;
			}
			while(q.empty()==1){
				out("子弹没了,重新填充");cout<<'\n'; 
				cz();
			}
			out("你要向谁开枪,1恶魔,2自己");cout<<'\n';
			int g;
			cin>>g;
			if(g==1){
				xue(2);
				out("继续");cout<<'\n';
				break;
			}
			else{
				out("向自己开枪");xue(1);cout<<'\n'; 
			} 
			out("继续");cout<<'\n'; 
		}
	}
	if(xs==0){
			out("你死了");return 0;
		}
	if(xm==0){
		out("恶魔死了");return 0;
	}
	out("游戏结束");
	
}	

1235