跳到正文

hello_world_114514

1804531

宣团:https://www.luogu.com.cn/team/137895,关注初二牲hello_world_114514谢谢喵,必互关--I`m hw114514

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

资料

编号
1804531
抓取

彩蛋

这个人很懒,什么都没写。 初二的人机一枚,请多多指教,欧耶! 迷宫代码小赏(本人几年前做):

C++
#include <iostream>
#include <stdlib.h> 
using namespace std;
int main()
{
	char a[22][22]= 
	{
		{'$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$'},
		{'$','^','&','*','^','@','_','^','&','%','|','-','&','#','$','!','%','&','#','&','%','&'},
		{'$','%','$','$','$','$','$','&','$','$','$','$','#','^','$','%','*','$','$','$','$','$'},
		{'$','@','$','#','&','!','#','%','$','_','&','@','$','#','+','$','?','&','&','$','&','$'},
		{'$','#','$','^','$','*','$','^','$','}','$','<','#','$','$','#','$','$','#','$','&','$'},
		{'$','*','&','@','$','^','$','%','$',']','$','!','&','%','*',')','$','$','@','$','&','$'},
		{'$','+','$','$','$','+','$','?','$','~','&','$','$','$','$','$','#','$','#','$','&','$'},
		{'$','%','$','+','$','|','$','!','$','$','#','/','|','}','@','#','$','$','*','$','&','$'},
		{'$','@','$',')','$',']','$','@','$','$','$','$','$','$','$','&','#','$','"','$','&','$'},
		{'$','!','$','.','&','>','$','#','&','_','$','`','#','?','#','$','=','$','+','$','&','$'},
		{'$','~','&','/','$','?','$','#','$','/','$','=','$','$','#','$','|','$','*','$','&','$'},
		{'$','`','$',',','$','}','&','^','$','|','$','?','$',';','#','$','?','$','%','$','&','$'},
		{'$','"','$','<','$','$','$','@','$','+','#','<','$',':','$','$','/','$','#','$','&','$'},
		{'$','#','$','&','&','#','$','#','$','$','$','$','#','>','#','$','.','$','!','$','&','$'},
		{'$','$','&','=','$','~','*','.','&',',',',','>','$','$','#','$',',','$','`','$','&','$'},
		{'$','%','$','~','$','$','$','*','$','$','$','|','$','<','#','$','+','$','}','$','&','$'},
		{'$','@','&','-','&','=','&','^','$','?','/','_','$','.','$','#','=','$','|','$','&','$'},
		{'$','#','$','$','$','-','$','%','$','.','$','+','$',',','#','=','$','$',']','$','&','$'},
		{'$','^','&','|','$','_','$',')','$','<','?','-','$','?','$','+','$','#','%','&','&','$'},
		{'$','!','$','=','$','.','$','<','$','$','$','&','$','$','$','$','$','$','$','$','&','$'},
		{'$','X','$','+','&','>','$',',','&','&','&','&','&','&','&','&','&','&','&','&','&','$'},
		{'$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$'},
	};
	for (int i = 0;i <= 21;i++)
	{
		for (int j = 0;j <= 21;j++)
		{
			cout << a[i][j];
		}
		cout << endl;
	}
	int x = 20,y = 1;
	char ch;
	while(1)
	{
		cin >> ch;
		system("cls");
		if(ch == 's' && a[x+1][y] != '$')
		{
			a[x][y] = ' ';
			x++;
			a[x][y] = 'X';
		}
		if(ch == 'w' && a[x-1][y] != '$')
		{
			a[x][y] = ' ';
			x--;
			a[x][y] = 'X';
		}
		if(ch == 'a' && a[x][y-1] != '$')
		{
			a[x][y] = ' ';
			y--;
			a[x][y] = 'X';
		}
		if(ch == 'd' && a[x][y+1] != '$')
		{
			a[x][y] = ' ';
			y++;
			a[x][y] = 'X';
		}
		for (int i = 0;i <= 21;i++)
		{
			for (int j = 0;j <= 21;j++)
			{
				cout << a[i][j];
			}
			cout << endl;
		}
		if (x == 1 && y == 21)
		{
			system("cls");
			cout << "666";
			break;
	    }
	}
	return 0;
}

还没有收录这位用户的文章。