跳到正文

HuangQitai

1486252

这个家伙很懒,什么也没有留下

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

资料

编号
1486252
抓取

奖项

2025 CSP-J
二等奖

一个平平无奇的学生

做题网站:

  1. Codeforces
  2. Virtual Judge
  3. 北二外
  4. 洛谷
  5. AtCoder
  6. Hydro
  7. 牛客

神秘计算小游戏:

C++
#include<bits/stdc++.h>
#include<Windows.h>
using namespace std;
const string RED = "\033[31m";
const string GREEN = "\033[32m";
const string YELLOW = "\033[33m";
const string RESET = "\033[0m";
const int mod = 1e6;
int cntr,cntw;
signed main(){
	random_device rd;
	while( 1 ){
		system("cls");
		cout << RESET;
		cout << "Enter 'e' to exit,or press any other key to continue:";
		char c = _getwche();
		if( c == 'e' ){
			system("cls");
			cout << "End!";
			Sleep( 1000 );
			system("cls");
			break;
		}
		cout << endl;
		mt19937 rng1( rd() ),rng2( rd() );
		int a = rng1() % mod,b = rng2() % mod;
		cout << "Which operation would you like to do?" << endl << "Enter an operator (+,-,*):";
		char ch = _getwche();
		cout << endl;
		cout << a << ' ' << b;
		cout << endl;
		if( ch == '+' ){
			cout << "Enter your answer:";
			int ans;
			cin >> ans;
			cout << endl;
			auto sum = a + b;
			if( to_string( sum ) == to_string( ans ) ){
				cout << GREEN << "Right" << RESET;
				cntr++;
			}
			else{
				cout << RED << "Wrong Answer" << RESET << endl << "The true answer is " << sum;
				cntw++;
			}
		}
		else if( ch == '-' ){
			cout << "Enter your answer:";
			int ans;
			cin >> ans;
			cout << endl;
			auto sum = a - b;
			if( to_string( sum ) == to_string( ans ) ){
				cout << GREEN << "Right" << RESET;
				cntr++;
			}
			else{
				cout << RED << "Wrong Answer" << RESET << endl << "The true answer is " << sum;
				cntw++;
			}
		}
		else if( ch == '*' ){
			cout << "Enter your answer:";
			int ans;
			cin >> ans;
			cout << endl;
			auto sum = a * b;
			if( to_string( sum ) == to_string( ans ) ){
				cout << GREEN << "Right" << RESET;
				cntr++;
			}
			else{
				cout << RED << "Wrong Answer" << RESET << endl << "The true answer is " << sum;
				cntw++;
			}
		} 
		else cout << YELLOW << "You entered an invalid character, please try again." << RESET;
		cout << endl;
		Sleep( 3000 );
		system("cls");
	}
	cout << "Let's see how you did!" << endl;
	cout << GREEN << "AC: " << cntr << RESET << endl;
	cout << RED << "W: " << cntw << RESET << endl;
	cout << YELLOW << "GAME OVER!" << RESET;
	return 0;
}

神秘走迷宫小游戏:

C++
#include<bits/stdc++.h>
#include<Windows.h>
using namespace std;
const int N = 40;
int x,y,cnt = 72;
char s[N+1][N+1] = {
"##############################",
"#****************************#",
"#* ####         #   #   #   *#",
"#*  # #     #    # ###   # #*#",
"#*#       #  # ## #   #### #*#",
"#* #######  ###  ## #### ###*#",
"#* #    # #   #  ## ### # # *#",
"#*     #  #    ######## #   *#",
"#*## ## # ##  #     ## # ###*#",
"#* #  *  # #  #   # # # # # *#",
"#* #   ###  # # # # # ## #  *#",
"#* #     # #    #   #####   *#",
"#* #  #   #   ##       #  # *#",
"#*     ### ### # #  # ##    *#",
"#* #      ##      #   #     *#",
"#*    ##  # ##   # ## ####  *#",
"#*# ## #   #### ##  #  # #  *#",
"#* #   #### # ##  # ## #    *#",
"#*     #   # # ## ###  # #  *#",
"#*##  *  ## #  #  ### ##    *#",
"#*####     # #    ##  ## ## *#",
"#*     #   #   ##### # #  ##*#",
"#* # #  # ### ### #     #  #*#",
"#*****       # ### # ##      #",
"## ## #### ### ### # ## **## #",
"### ## ##        ### #   # # #",
"## ## ## #### * ## #* #  *   #",
"*# ###         # * # #   # E##",
"#********#**************   ***",
"##############################"
};
char t[N][N];
void dead(){
	system("cls");
	cout << "You dead!";
	Sleep( 1000 );
	for(int i = 1;i <= 1000;i++) cout << "DANGER DANGER DANGER! \N Please restart!";
	Sleep( 1000 );
	exit( 0 );
}
void warn(){
	system("cls");
	for(int i = 1;i <= 1000;i++) cout << "WARNING WARNING WARNING! \N Please restart!";
	Sleep( 1000 );
	x = 2,y = 2;
} 
void won(){
	system("cls");
	cout << "You won!"<<"\n";
	cout << "GAME OVER";
	exit(0);
}
void solve(){
	system("cls");
	for(int i = 0;i < N;i++){
		for(int j = 0;j < N;j++) t[i][j] = s[i][j];
	}
	t[x][y] = 'S';
	for(int i = 0;i < N;i++) cout << t[i] << '\n';
	cnt--;
	cout << "You have " << cnt << " chances";
	if( !cnt ) dead();
}
signed main(){
	x = 2,y = 2;
	solve();
	while( 1 ){
		char ch = _getwche();
		if( ch == 'a' ){
			if( s[x][y-1] == '#' ) dead();
			if( s[x][y-1] == '*' ) warn();
			if( s[x][y-1] != '#' || s[x][y-1] != '*' ) y--;
		}
		if( ch == 'd' ){
			if( s[x][y+1] == '#' ) dead();
			if( s[x][y+1] == '*' ) warn();
			if( s[x][y+1] != '#' || s[x][y+1] != '*' ) y++;
		}
		if( ch == 's' ){
			if( s[x+1][y] == '#' ) dead();
			if( s[x+1][y] == '*' ) warn();
			if( s[x+1][y] != '#' || s[x+1][y] != '*' ) x++;
		}
		if( ch == 'w' ){
			if( s[x-1][y] == '#' ) dead();
			if( s[x-1][y] == '*' ) warn();
			if( s[x-1][y] != '#' || s[x-1][y] != '*' ) x--;
		}
		solve();
		if( s[x][y] == 'E' ){
			won();
		}
	}
	return 0;
}

关机小代码

C++
#include<bits/stdc++.h> 
using namespace std;
unsigned long long t;
signed main(){
	std::ostringstream oss;
	cin >> t;
    cout << "You have" << ' ' << t << ' ' << "seconds.";
	oss << t;
	system( ( "shutdown -s -t " + oss.str() ).c_str() );
	return 0;
}

连点器(L左,R右,ESC退出)

C++
#include<Windows.h>
signed main() {
    while( true ){
        if( GetAsyncKeyState( 'L' ) ){
            mouse_event( 2,0,0,0,0 );
            mouse_event( 4,0,0,0,0 );
            Sleep( 1 );
        }
        if( GetAsyncKeyState( 'R' ) ){
            mouse_event( 8,0,0,0,0 );
            mouse_event( 16,0,0,0,0 );
            Sleep( 1 );
        }
        if( GetAsyncKeyState( VK_ESCAPE ) ) break;
        Sleep( 29 );
    }
    return 0;
}

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