跳到正文

czhh1

2085535

这个家伙很懒,什么都留下了

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

资料

编号
2085535
抓取

想jc就jc吧,反正别改我密码就行

国有国法,站有站规

好东西

页面优化 图论模拟器 GPT Oier 洛谷 Acgo Atcoder VisuAlgo tyoi模拟器 AFO OIWIKI

oiclass的域

noi (AKNOI)

普转提 (pu2ti)

普及组 (puji)

oiClass (system)

提高组 (tigao)

培训组 (train)

代码
"AC=Answer Coarse=粗劣的答案"

"WA=Wonderful Answer=好答案"

"TLE=Time Limit Enough=时间充裕"

"MLE=Memory Limit Enough=内存充裕"

"CE=Compile Easily=轻松通过编译"

"RE=Run Excellently=完美运行"

"UKE=Unbelievablly Keep Enough Score=难以置信地保持足够的分数"

"AU=All Unaccepted=全都不正确"
C++
 ______       _______  __  __        ______    _____    ______     
/\__  _\     /\  _  \ /\ \/\ \      /\__  _\  /\  __\  /\__  _\    
\/_/\ \/     \ \ \ \ \ \ \ \/'/     \/_/\ \/  \ \ \ \\ \/_/\ \/    
   \ \ \      \ \  __ \ \ \   ,        \ \ \   \ \ \ \\   \ \ \    
    \_\ \__    \ \ \ \ \ \ \ \\`\       \_\ \__ \ \ \_\\   \_\ \__ 
    /\_____\    \ \_\ \_\ \ \_\ \_\     /\_____\ \ \____\  /\_____\
    \/_____/     \/_/\/_/  \/_/\/_/     \/_____/  \/_____/ \/_____/


************************* ******************************
********************************************************
**************  ********* ******     ****** *    *******
************      ******* ****** *** ******  ***********
**********   ***   ****** ******     ****** ************
***********  ***  ******* ****** ********** ************
************     ******** ******     ****** ************
********************************************************123456123456
C++
           ____                             ____                   _____                            _____                  ____ __                  _____           
         /\    \                          /\    \                 /\    \                          /\    \                /::\    \                /\    \         
        /::\    \                        /::\    \               /::\____\                        /::\    \              /::::\    \              /::\    \        
        \:::\    \                      /::::\    \             /:::/    /                        \:::\    \            /::::::\    \             \:::\    \       
         \:::\    \                    /::::::\    \           /:::/    /                          \:::\    \          /::::::::\    \             \:::\    \      
          \:::\    \                  /:::/\:::\    \         /:::/    /                            \:::\    \        /:::/--\:::\    \             \:::\    \     
           \:::\    \                /:::/__\:::\    \       /:::/____/                              \:::\    \      /:::/    \:::\    \             \:::\    \    
           /::::\    \              /::::\   \:::\    \     /::::\    \                              /::::\    \    /:::/    / \:::\    \            /::::\    \   
  ____    /::::::\    \            /::::::\   \:::\    \   /::::::\____\________            ____    /::::::\    \  /:::/____/   \:::\____\  ____    /::::::\    \  
 /\   \  /:::/\:::\    \          /:::/\:::\   \:::\    \ /:::/\:::::::::::\    \          /\   \  /:::/\:::\    \|:::|    |     |:::|    |/\   \  /:::/\:::\    \ 
/::\   \/:::/  \:::\____\        /:::/  \:::\   \:::\___/:::/   |:::::::::::\____\        /::\   \/:::/  \:::\____|:::|____|     |:::|    /::\   \/:::/  \:::\____\
\:::\  /:::/    \::/    /        \::/    \:::\  /:::/    \::/   |::|   |                  \:::\  /:::/    \::/    /\:::\    \   /:::/    /\:::\  /:::/    \::/    /
 \:::\/:::/    / \/____/          \/____/ \:::\/:::/    / \/____|::|   |                   \:::\/:::/    / \/____/  \:::\    \ /:::/    /  \:::\/:::/    / \/____/ 
  \::::::/    /                            \::::::/    /        |::|   |                    \::::::/    /            \:::\    /:::/    /    \::::::/    /          
   \::::/____/                              \::::/    /         |::|   |                     \::::/____/              \:::\__/:::/    /      \::::/____/           
    \:::\    \                              /:::/    /          |::|   |                      \:::\    \               \::::::::/    /        \:::\    \           
     \:::\    \                            /:::/    /           |::|   |                       \:::\    \               \::::::/    /          \:::\    \          
      \:::\    \                          /:::/    /            |::|   |                        \:::\    \               \::::/    /            \:::\    \         
       \:::\____\                        /:::/    /             \::|   |                         \:::\____\               \::/____/              \:::\____\        
        \::/    /                        \::/    /               \:|   |                          \::/    /                                       \::/    /        
         \/____/                          \/____/                 \|___|                            \/___/                                         \/____/     

代码模板

floyd

C++
#include<bits/stdc++.h>
using namespace std;
const int inf=1e9;
const int N=550;
int n,m,d[N][N];
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++)d[i][j]=inf;d[i][i]=0;
	}
	for(int i=1;i<=m;i++){
		int u,v,w;
		cin>>u>>v>>w;
		d[u][v]=d[v][u]=min(d[u][v],w);
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				d[i][j]=min(d[i][k]+d[k][j],d[i][j]);
			}
		}
	}
	return 0;
}
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++
C++

较好玩的

C++
#include <iostream>
#include <conio.h>
#include <windows.h>
#include <ctime>
#include <cstdlib>
#include <cctype>

using namespace std;

const int HEIGHT = 16;
const int LANES = 4;
const int HIT_LINE = 13;

int notes[HEIGHT][LANES] = {};
char keys[LANES] = {'D', 'F', 'J', 'K'};

int score = 0;
int combo = 0;
int maxCombo = 0;
int perfect = 0;
int miss = 0;

bool running = true;
int frame = 0;
int spawnTimer = 0;

void drawGame() {
	system("cls");
	
	cout << "====================================\n";
	cout << "          RHYTHM GAME\n";
	cout << "====================================\n";
	cout << "Score: " << score
	<< "   Combo: " << combo
	<< "   Max: " << maxCombo << "\n\n";
	
	cout << "       D       F       J       K\n";
	
	for (int y = 0; y < HEIGHT; y++) {
		if (y == HIT_LINE)
			cout << " >> ";
		else
			cout << "    ";
		
		cout << "|";
		
		for (int x = 0; x < LANES; x++) {
			if (notes[y][x])
				cout << "   O   |";
			else
				cout << "       |";
		}
		
		if (y == HIT_LINE)
			cout << " << HIT";
		
		cout << "\n";
	}
	
	cout << "\nPress D F J K to hit notes | ESC to exit\n";
	cout << "Perfect: " << perfect << "   Miss: " << miss << "\n";
}

void hitNote(int lane) {
	// 判定线前后都允许击打,避免时机过于苛刻
	int bestRow = -1;
	int bestDistance = 999;
	
	for (int y = HIT_LINE - 1; y <= HIT_LINE + 1; y++) {
		if (y < 0 || y >= HEIGHT)
			continue;
		
		if (notes[y][lane]) {
			int distance = abs(y - HIT_LINE);
			
			if (distance < bestDistance) {
				bestDistance = distance;
				bestRow = y;
			}
		}
	}
	
	if (bestRow != -1) {
		notes[bestRow][lane] = 0;
		
		score += (bestDistance == 0 ? 100 : 70);
		combo++;
		perfect++;
		
		if (combo > maxCombo)
			maxCombo = combo;
	}
}

void moveNotes() {
	// 先处理上一轮已经到达底部的音符
	for (int x = 0; x < LANES; x++) {
		if (notes[HEIGHT - 1][x]) {
			notes[HEIGHT - 1][x] = 0;
			miss++;
			combo = 0;
		}
	}
	
	// 从底向上移动,防止同一个音符移动多格
	for (int y = HEIGHT - 1; y > 0; y--) {
		for (int x = 0; x < LANES; x++) {
			notes[y][x] = notes[y - 1][x];
		}
	}
	
	for (int x = 0; x < LANES; x++)
		notes[0][x] = 0;
}

int main() {
	srand((unsigned)time(NULL));
	
	cout << "====================================\n";
	cout << "          RHYTHM GAME\n";
	cout << "====================================\n\n";
	cout << "Keys: D F J K\n";
	cout << "Press the matching key near the HIT line.\n";
	cout << "Press any key to start...\n";
	
	_getch();
	
	while (running) {
		// 先读取按键,再移动音符
		while (_kbhit()) {
			int ch = _getch();
			
			if (ch == 27) {
				running = false;
				break;
			}
			
			ch = toupper(ch);
			
			for (int lane = 0; lane < LANES; lane++) {
				if (ch == keys[lane])
					hitNote(lane);
			}
		}
		
		if (!running)
			break;
		
		frame++;
		spawnTimer++;
		
		// 每约 0.8 秒生成一个音符
		if (spawnTimer >= 10) {
			spawnTimer = 0;
			
			int lane = rand() % LANES;
			
			// 不覆盖已有音符
			if (!notes[0][lane])
				notes[0][lane] = 1;
		}
		
		// 每 160 毫秒下落一格
		if (frame % 2 == 0)
			moveNotes();
		
		drawGame();
		
		Sleep(80);
	}
	
	system("cls");
	
	cout << "========== GAME OVER ==========\n\n";
	cout << "Score: " << score << "\n";
	cout << "Successful hits: " << perfect << "\n";
	cout << "Misses: " << miss << "\n";
	cout << "Max combo: " << maxCombo << "\n\n";
	
	cout << "Press any key to exit...";
	_getch();
	
	return 0;
}

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