跳到正文

yi_zhi_ju_ruo

1419629

喵~

在洛谷打开
资料、奖项与版本

资料

编号
1419629
抓取

版本

  1. v3当前
  2. v2
  3. v1

下一题:P1683
神秘专栏

https://chatglm.cn

https://aakaakii.github.io/vr-oi-simulator/

洛谷假钩生成器

https://www.luogu.me/article/jziyuqeq

内卷中……
狼人杀
https://www.luogu.me/paste/haohkajd
https://www.luogu.com.cn/feed/watching?page=1
https://weiyc2.github.io/oimoniqi/
https://qoj.ac/files/OItrainer-main/start.html
https://bj8z.zeabur.app/
https://chenzheaya.github.io/OnlineJudgeMaintainerSimulator/
https://paperzym.github.io/whk/
https://gxwtf.cn/game/recall

C++
#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
using namespace std;
char a[1000][1000];
char b[1000][1000];
int vis[1000][1000],dx[8]={-1,-1,-1,0,0,1,1,1},dy[8]={-1,0,1,-1,1,-1,0,1};
struct node{
	int x,y;
};
int bfs(int x,int y){
	int cnt=0;
	queue<node> q;
	q.push({x,y});
	while(!q.empty()){
		node now=q.front();
		q.pop();
		if(b[now.x][now.y]=='*')break;
		vis[now.x][now.y]=1,cnt++;
		for(int i=0;i<=7;i++){
			int zx=now.x+dx[i],zy=now.y+dy[i];
			if(zx>=1&&zx<=8&&zy>=1&&zy<=8){
				q.push({zx,zy});
			}
		}
	}
	return cnt;
}
bool start(){
	cout<<"开始游戏"<<endl;
	memset(vis,0,sizeof(vis));
	for(int i=1;i<=8;i++){
		for(int j=1;j<=8;j++){
			b[i][j]='0';
		}
	}
	srand(time(0));
	srand(time(0));
	for(int i=1;i<=8;i++){
		int x=rand()%8+1,y=rand()%8+1;
		while(b[x][y]=='*')x=rand()%8+1,y=rand()%8+1;
		b[x][y]='*';
	}
	for(int i=1;i<=8;i++){
		for(int j=1;j<=8;j++){
			if(b[i][j]=='*'){
				if(b[i-1][j-1]!='*')b[i-1][j-1]++;
				if(b[i-1][j]!='*')b[i-1][j]++;
				if(b[i-1][j+1]!='*')b[i-1][j+1]++;
				if(b[i][j-1]!='*')b[i][j-1]++;
				if(b[i][j+1]!='*')b[i][j+1]++;
				if(b[i+1][j-1]!='*')b[i+1][j-1]++;
				if(b[i+1][j]!='*')b[i+1][j]++;
				if(b[i+1][j+1]!='*')b[i+1][j+1]++;
			}
		}
	}
	cout<<"正在初始化地图";
	cout<<".";
	Sleep(700);
	cout<<".";
	Sleep(700);
	cout<<".";
	Sleep(700);
	cout<<endl;
	cout<<"地图初始化成功。"<<endl;
	cout<<"请按任意键开始游戏"<<endl;
//	for(int i=1;i<=8;i++){
//		for(int j=1;j<=8;j++){
//			cout<<b[i][j];
//		}
//		cout<<endl;
//	}//请勿开桂 
	getch();
	bool jieshu=0;
	int fanpaishuliang=0;
	while(!jieshu){
		system("cls");
		for(int i=0;i<=8;i++){
			for(int j=0;j<=8;j++){
				if(!vis[i][j])cout<<a[i][j];
				else cout<<b[i][j];
			}
			cout<<endl;
		}
		Sleep(200);
		cout<<"要翻哪个格子?(先输入行,再输入列,中间用空格分隔)"<<endl;
		int x,y;
		cin>>x>>y;
		if(b[x][y]=='*'){
			cout<<"恭喜你中奖了"<<endl;
			cout<<"游戏结束"<<endl;
			cout<<"地图:"<<endl;
			for(int i=0;i<=8;i++){
				for(int j=0;j<=8;j++){
					if(i==0||j==0)cout<<a[i][j];
					else cout<<b[i][j];
				}
				cout<<endl;
			}
			cout<<"请按任意键继续…"<<endl;
			getch();
			break;
		}
		bfs(x,y);
		int fanpaishuliang=0;
		for(int i=1;i<=8;i++){
			for(int j=1;j<=8;j++){
				fanpaishuliang+=vis[i][j];
			}
		}
		if(fanpaishuliang==8*8-8){
			cout<<"666居然赢了太有实力了"<<endl;
			cout<<"%%%orz"<<endl;
			cout<<"游戏结束"<<endl;
			cout<<"地图:"<<endl;
			for(int i=0;i<=8;i++){
				for(int j=0;j<=8;j++){
					if(i==0||j==0)cout<<a[i][j];
					else cout<<b[i][j];
				}
				cout<<endl;
			}
			cout<<"请按任意键继续…"<<endl;
			getch();
			break;
		}
	}
	cout<<"还要继续吗?要输入1,不要输入0"<<endl;
	int jixu;
	cin>>jixu;
	system("cls");
	return jixu;
}
signed main () {
	for(int i=1;i<=8;i++){
		for(int j=1;j<=8;j++){
			a[i][j]='#';
		}
	}
	for(int i=1;i<=8;i++)a[i][0]=a[0][i]=i+'0';
	a[0][0]=' ';
	cout<<"欢迎来到扫雷游戏"<<endl;
	cout<<"难度:简单"<<endl;
	cout<<"一共有8颗雷"<<endl;
	cout<<"每次输入2个数表示揭开的位置"<<endl;
	cout<<"按任意键开始游戏"<<endl;
	getch();
	system("cls");
	while(1)if(!start())break;
	cout<<"游戏结束,欢迎下次再来。"<<endl;
	int cnt=20;
	while(cnt--){
		cout<<"bye~bye"<<endl;
		Sleep(100);
	}
	return 0;
}
//想改变难度的话就把所有的8替换掉,再任意调整雷的数量。 
/*
tiaoshi
002*32*1
002*3*21
00112110
00000111
000001*1
11100122
1*10002*
1110002*
调试 
*/

https://www.cnblogs.com/mcr130102/articles/18703945/xiaoshuo
好玩的

洛谷祭台

2024.8.9注册

2024.9 蓝名\color{Blue}{蓝名}

2024.10.21 绿名\color{green}{绿名}

2024.10.15首A蓝题!\color{Blue}{蓝题!}

2024.10.23首A紫题!\color{purple}{紫题!}

(虽然看了题解但也A了。QAQ)

2024.11.1

100AC祭\color{green}{100AC祭}

2024.12.6

连续登录100天

2024.12.16

连续登录110天

2024.12.25

连续登录119天

2024.12.26

连续登录120天

2026.8.10

第一次橙名祭(我好蒻啊)

主页
神秘 这期神了

THEEND\color{red}{THE END}

共 3 篇
  1. 休闲·娱乐

    论OI各阶段的心态

    本文以幽默方式总结了OI(信息学竞赛)不同阶段选手的心态变化: 蒟蒻初入赛场,自认为实力出众,轻松刷题甚至幻想AK IOI; 小牛阶段逐渐意识到难度,虽效率尚可但只能完成少量橙题; 中牛面对复杂代码(如屎山代码)和绿题感到力不从心; 大牛虽水平一般,但遇到蓝题仍会因WA求救; 神牛调侃自己计划做紫题后放松,强调劳逸结合; 神犇则自嘲实力薄弱,渴望向大佬请教突破方法。 作者坦言自身实力有限,总结可能存在不准确之处。

  2. 科技·工程

    进入小黑屋板块的方法

    摘要:通过点击洛谷下方小黑屋按键进入,输入小黑屋网址后,在讨论区找到名为miaomiaowu的板块即可进入。

  3. 休闲·娱乐

    有人还记得小棕兔吗?

    2024 年 10 月,于 xht 发帖指出@小粉兔 在竞赛中使用了@NaCly_Fish 赛前编写的代码,并提及纪念“小棕兔”。