版本比较
OI 2048
正文
增加 39 行删除 18 行
112344567839 行未改动4849505152535455565720 行未改动7879808180828384858687888990919293869495889697909899921001011029510310410510610783 行未改动19119219319418719519619719819911 行未改动21121221321420721521621721821928 行未改动24824925025124425225325425525625725825925226026126226326428 行未改动29329429529629729829930030130230329030430530630730815 行未改动324325326327314315328329330331332333334335336337338339340341322323324342343344345346347348349350351```cpp line-numbers```cpp#include <bits/stdc++.h>#include <windows.h>#include <conio.h> #include <conio.h>#define endl '\n'using namespace std;
const int N = 150;39 行未改动 else if(col == "light_yellow") SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14); else if(col == "light_white") SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15); else if(col == "cholly") SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 96); else SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);}
20 行未改动 else if(x == 9) setcolor("yellow"), printf(" 树套树 "), setcolor("white"); else if(x == 10) setcolor("red"), printf("K-D Tree"), setcolor("white"); else else if(x == 11) setcolor("purple"), printf(" 动态树 "), setcolor("white"); else if(x == 12) setcolor("grey"), printf(" ETT "), setcolor("white"); else if(x == 13) setcolor("blue"), printf(" SATT "), setcolor("white"); else setcolor("cholly"), printf("珂朵莉树"), setcolor("white");}
void output(){ system("cls"); system("cls"); printf("合成"); output_single(11); output_single(14); printf("\n使用↑↓←→移动\n"); printf("你目前的得分是:%d\n", score); printf("你目前的得分是:%d\n", score); printf("合成顺序:"); for(int i = 1; i <= 11; i++) for(int i = 1; i <= 14; i++) { output_single(i); if(i != 11) printf("->"); if(i != 14) printf("->"); } printf("\n"); for(int i = 1; i <= siz; i ++) {83 行未改动 else nw[++ nt] = r[j]; for(int j = 1; j <= siz; j++) board[j][i] = 0; for(int j = 1; j <= nt; j++) board[j][i] = nw[j]; board[j][i] = nw[j]; }}
void down(int (&board)[N][N])11 行未改动 else nw[++ nt] = r[j]; for(int j = 1; j <= siz; j++) board[j][i] = 0; for(int j = 1; j <= nt; j++) board[siz - j + 1][i] = nw[nt - j + 1]; board[siz - j + 1][i] = nw[nt - j + 1]; }}
bool cant_move()28 行未改动 for(int j = 1; j <= siz; j ++) if(board_res[i][j] != board[i][j]) return false; for(int i = 1; i <= siz; i ++) for(int j = 1; j <= siz; j ++) board_res[i][j] = board[i][j]; board_res[i][j] = board[i][j]; return true;}
bool win(){ for(int i = 1; i <= siz; i ++) for(int j = 1; j <= siz; j ++) if(board[i][j] > 10) return true; if(board[i][j] > 13) return true; return false;}
int nowmx = 0;28 行未改动 else if(x == 9) MessageBox(NULL, "对于序列问题有着仅次于分块的处理能力,适配面十分广。", "树套树", MB_OK); else if(x == 10) MessageBox(NULL, "K-D Tree 是处理高维空间问题的利器。", "K-D Tree", MB_OK); else if(x == 11) MessageBox(NULL, "在树上,动态树就是无敌的。连边断边,链查链改!", "动态树", MB_OK); else if(x == 12) MessageBox(NULL, "一个很全面的数据结构,可惜用 LCT 维护的话会有 2 只 log。", "ETT", MB_OK); else if(x == 13) MessageBox(NULL, "这种数据结构也只会在重工业 Sone1 用得到了……", "SATT", MB_OK); else MessageBox(NULL, "在树上,动态树就是无敌的。连边断边,链查链改!", "动态树", MB_OK); MessageBox(NULL, "我永远喜欢珂朵莉!", "珂朵莉树", MB_OK);}
int main(){15 行未改动 { for(int i = nowmx + 1; i <= k; i++) display(i); nowmx = k; } char c = 114; while(c != 75 && c != 77 && c != 72 && c != 80) c = _getch(); char c = 114, r = rand() % 4;/*下面这个是自动随机代打的代码*/ if(r == 0) c = 75; else if(r == 1) c = 77; else if(r == 2) c = 72; else c = 80;/*下面这个是手动输入的代码*/ //while(c != 75 && c != 77 && c != 72 && c != 80) c = _getch(); if(c == 75) left(board); else if(c == 77) right(board); else if(c == 72) up(board); else down(board); if(win()) { output(); MessageBox(NULL, "你胜利了!你合成了动态树!", "胜利", MB_OK); display(11); output(); MessageBox(NULL, "你胜利了!你合成了珂朵莉树!", "胜利", MB_OK); display(14); return 0; } Sleep(10); } return 0;}```