Gemini 4 Rngdle 代码
Water_Lemon · · 个人记录
真的牛
upd:第三版
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
#include <ctime>
#define b(i, s, x) {name[i] = s; EP[i] = x;}
using namespace std;
const int INF = 1e6, BADGE_NUM = 233;
mt19937 rd(chrono::system_clock::now().time_since_epoch().count());
int rnd(int MAXN = INF) { return rd() % (MAXN + 1); }
int num, len;
int subnum[8][7];
int cnt[10], dsum, distinct;
bool havebadge[BADGE_NUM];
long long myEP;
string name[BADGE_NUM];
int EP[BADGE_NUM];
vector<int> clash[BADGE_NUM];
// 生涯与历史记录数据结构
struct RollRecord {
int rollId;
int number;
long long score;
char mode; // 'N': Normal, 'D': Daily, 'C': Custom
};
vector<RollRecord> recentHistory; // 最近记录
vector<RollRecord> topHistory; // 历史最高 Top 5
int totalRolls = 0;
long long bestEP = 0;
int bestNum = -1;
bool fastMode = false;
bool dailyMode = false;
// 每日种子相关数据
string todayDateStr = "";
unsigned int todaySeedVal = 0;
mt19937 dailyRng;
int dailyRollCount = 0;
long long dailyBestEP = 0;
int dailyBestNum = -1;
long long daily5TotalEP = 0;
// ==================== 基础工具函数 ====================
void ShowCursor(bool visible) {
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cursorInfo;
GetConsoleCursorInfo(hOut, &cursorInfo);
cursorInfo.bVisible = visible;
SetConsoleCursorInfo(hOut, &cursorInfo);
}
void SetColor(int fore = 7, int back = 0) {
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hOut, (back << 4) | fore);
}
void GotoXY(int x, int y) {
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X = (SHORT)x;
pos.Y = (SHORT)y;
SetConsoleCursorPosition(hOut, pos);
}
COORD GetCursorPos() {
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hOut, &csbi);
return csbi.dwCursorPosition;
}
string IntToStr(long long x) {
if (x == 0) return "0";
string s = "";
while (x > 0) {
s += (char)('0' + (x % 10));
x /= 10;
}
reverse(s.begin(), s.end());
return s;
}
string FormatNum(long long x) {
string s = IntToStr(x), ret = "";
int n = s.size();
for (int i = 0; i < n; i++) {
ret += s[i];
if ((n - 1 - i) % 3 == 0 && i != n - 1) ret += ",";
}
return ret;
}
bool SmartSleep(int ms) {
if (fastMode) return true;
int step = 15;
for (int t = 0; t < ms; t += step) {
if (_kbhit()) {
int ch = _getch();
if (ch == ' ' || ch == '\r') return true;
}
Sleep(min(step, ms - t));
}
return false;
}
// 前置声明
void init();
bool chk(int id);
// 快速评估某个数字的EP得分(用于生成每日高分种子)
long long QuickEvalEP(int testNum) {
num = testNum;
init();
long long total = 0;
for (int i = 0; i < BADGE_NUM; i++) {
bool f = 1;
for (size_t j = 0; j < clash[i].size(); j++) {
if (havebadge[clash[i][j]]) { f = 0; break; }
}
if (!f) continue;
if (chk(i)) {
havebadge[i] = 1;
total += EP[i];
}
}
return total;
}
// 初始化今日日期与每日种子发生器
void ResetDailySeed() {
time_t now = time(0);
tm *ltm = localtime(&now);
int y = 1900 + ltm->tm_year;
int m = 1 + ltm->tm_mon;
int d = ltm->tm_mday;
todayDateStr = IntToStr(y) + "-" + (m < 10 ? "0" : "") + IntToStr(m) + "-" + (d < 10 ? "0" : "") + IntToStr(d);
todaySeedVal = (unsigned int)(y * 10000 + m * 100 + d) ^ 0x9E3779B9;
dailyRng.seed(todaySeedVal);
dailyRollCount = 0;
daily5TotalEP = 0;
}
// 从今日种子中抽取下一个高分号码(确定性高分算法)
int GetNextDailyHighNumber() {
dailyRollCount++;
// 根据当前是第几抽,决定底层气运池采样次数(第5抽为今日终极爆发抽)
int tries = 35;
if (dailyRollCount % 5 == 2) tries = 80;
else if (dailyRollCount % 5 == 3) tries = 180;
else if (dailyRollCount % 5 == 4) tries = 400;
else if (dailyRollCount % 5 == 0) tries = 1200; // 每逢第5抽必出极高分
// 每日终极抽额外拥有高概率直通神话/传说池
int bestCandidate = 0;
long long bestCandEP = -1;
if (dailyRollCount % 5 == 0 && (dailyRng() % 100 < 75)) {
int mythicPool[] = {
69, 777, 777777, 420, 666, 1337, 7734, 80085, 42, 911, 404, 666666,
17776, 696969, 420420, 911911, 424242, 1984, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
365365, 86400, 1000000, 69420, 42069, 247365, 8192, 131072, 524288,
628318, 161803, 314159, 271828, 78910, 823543, 362880, 123456, 654321,
987654, 888888, 999999, 531441
};
int poolSize = sizeof(mythicPool) / sizeof(mythicPool[0]);
return mythicPool[dailyRng() % poolSize];
}
for (int t = 0; t < tries; t++) {
int cand = dailyRng() % (INF + 1);
long long score = QuickEvalEP(cand);
if (score > bestCandEP) {
bestCandEP = score;
bestCandidate = cand;
}
}
return bestCandidate;
}
// 更新历史记录与Top5排行榜
void RecordHistory(int number, long long score, char mode) {
RollRecord rec;
rec.rollId = (mode == 'D') ? dailyRollCount : (totalRolls + 1);
rec.number = number;
rec.score = score;
rec.mode = mode;
recentHistory.insert(recentHistory.begin(), rec);
if (recentHistory.size() > 5) recentHistory.pop_back();
// 真实抽取(普通模式或每日种子)计入Top 5名人堂
if (mode != 'C') {
bool exists = false;
for (size_t i = 0; i < topHistory.size(); i++) {
if (topHistory[i].number == number && topHistory[i].mode == mode) {
exists = true;
break;
}
}
if (!exists) {
topHistory.push_back(rec);
sort(topHistory.begin(), topHistory.end(), [](const RollRecord &a, const RollRecord &b) {
return a.score > b.score;
});
if (topHistory.size() > 5) topHistory.pop_back();
}
}
}
// ==================== 顶部 UI 面板 ====================
void DrawHeader(bool isCustom = false) {
system("cls");
SetColor(11, 0);
cout << " +==========================================================================+\n";
cout << " |";
if (dailyMode && !isCustom) {
SetColor(0, 14);
string title = " * RNGDLE DELUXE - DAILY HIGH-SCORE SEED [" + todayDateStr + "] * ";
while (title.size() < 74) title += " ";
cout << title;
} else {
SetColor(15, 1);
cout << " * R N G D L E D E L U X E * ";
}
SetColor(11, 0);
cout << "|\n";
cout << " +--------------------------------------------------------------------------+\n";
// 第一行统计:常规与模式
cout << " | ";
SetColor(7, 0); cout << "Rolls: ";
SetColor(15, 0); cout << left << setw(7) << totalRolls;
SetColor(7, 0); cout << "All-Time Best: ";
string bestStr = (bestNum == -1) ? "None" : (FormatNum(bestEP) + " EP (#" + IntToStr(bestNum) + ")");
SetColor(14, 0); cout << left << setw(24) << bestStr;
SetColor(7, 0); cout << "Mode: ";
if (isCustom) {
SetColor(15, 5); cout << " CUSTOM ";
} else if (dailyMode) {
SetColor(0, 14); cout << " DAILY ";
} else if (fastMode) {
SetColor(0, 10); cout << " FAST ";
} else {
SetColor(0, 11); cout << " NORMAL ";
}
SetColor(11, 0);
cout << " |\n";
// 第二行统计:每日高分种子专属数据
cout << " | ";
SetColor(14, 0); cout << "Daily Seed [" << todayDateStr << "] ";
SetColor(7, 0); cout << "Best: ";
string dBestStr = (dailyBestNum == -1) ? "None" : (FormatNum(dailyBestEP) + " EP");
SetColor(12, 0); cout << left << setw(18) << dBestStr;
SetColor(7, 0); cout << "5-Roll Total: ";
string dTotalStr = FormatNum(daily5TotalEP) + " (" + IntToStr(min(dailyRollCount, 5)) + "/5)";
SetColor(10, 0); cout << left << setw(10) << dTotalStr;
SetColor(11, 0);
cout << "|\n";
cout << " +==========================================================================+\n\n";
}
// 绘制单个数字卡槽
void DrawCard(int x, int y, char ch, int borderCol, int textCol) {
SetColor(borderCol, 0);
GotoXY(x, y); cout << "+-----+";
GotoXY(x, y + 1); cout << "| ";
SetColor(textCol, 0);
cout << ch;
SetColor(borderCol, 0);
cout << " |";
GotoXY(x, y + 2); cout << "+-----+";
}
// ==================== 7卡槽老虎机旋转动画 ====================
int RollSlotMachine(int customVal = -1) {
int ret;
if (customVal != -1) ret = customVal;
else if (dailyMode) ret = GetNextDailyHighNumber();
else ret = rnd(INF);
int cardY = 7;
int cardX[7] = {9, 18, 27, 36, 45, 54, 63};
int targetDigits[7] = {0};
int temp = ret;
for (int i = 6; i >= 0; i--) {
targetDigits[i] = temp % 10;
temp /= 10;
}
int firstNonZero = 6;
for (int i = 0; i < 6; i++) {
if (targetDigits[i] != 0) { firstNonZero = i; break; }
}
for (int i = 0; i < 7; i++) {
DrawCard(cardX[i], cardY, '-', 8, 8);
}
while (_kbhit()) _getch();
bool skip = fastMode;
int lockStep[7] = {8, 14, 20, 26, 32, 40, 52};
int totalSteps = (customVal != -1) ? 16 : 52;
for (int step = 1; step <= totalSteps && !skip; step++) {
for (int pos = 0; pos < 7; pos++) {
int lockAt = (customVal != -1) ? (pos * 2 + 2) : lockStep[pos];
if (step < lockAt) {
if (pos == 0 && ret != INF) {
GotoXY(cardX[pos] + 3, cardY + 1);
SetColor(8, 0); cout << ".";
} else {
GotoXY(cardX[pos] + 3, cardY + 1);
SetColor(7, 0); cout << (char)('0' + rnd(9));
}
} else if (step == lockAt) {
if (pos < firstNonZero) {
DrawCard(cardX[pos], cardY, ' ', 8, 8);
} else {
int bCol = (ret == INF) ? 12 : ((customVal != -1) ? 13 : (dailyMode ? 14 : 11));
int tCol = (ret == INF) ? 12 : 14;
DrawCard(cardX[pos], cardY, (char)('0' + targetDigits[pos]), bCol, tCol);
}
}
}
int delay = (step > 40) ? (20 + (step - 40) * 5) : 22;
if (SmartSleep(delay)) skip = true;
}
for (int pos = 0; pos < 7; pos++) {
if (pos < firstNonZero) {
DrawCard(cardX[pos], cardY, ' ', 8, 8);
} else {
int bCol = (ret == INF) ? 12 : ((customVal != -1) ? 13 : (dailyMode ? 14 : 11));
int tCol = (ret == INF) ? 12 : 14;
DrawCard(cardX[pos], cardY, (char)('0' + targetDigits[pos]), bCol, tCol);
}
}
GotoXY(0, cardY + 4);
SmartSleep(250);
return ret;
}
// ==================== 数据预处理与徽章判定 ====================
void init() {
len = 0;
int x = num;
do { len++; x /= 10; } while (x);
for (int le = 1; le <= 7; le++)
for (int i = 0; i < 7; i++) subnum[le][i] = -1;
for (int le = 1, _ = 10; le <= len; le++, _ *= 10)
for (int l = 1, r = _, i = 0; i <= len - le; i++, l *= 10, r *= 10)
subnum[le][i] = num % r / l;
memset(cnt, 0, sizeof(cnt));
dsum = 0;
distinct = 0;
for (int i = 0; i < len; i++) {
int d = subnum[1][i];
if (cnt[d] == 0) distinct++;
cnt[d]++;
dsum += d;
}
for (int i = 0; i < BADGE_NUM; i++) havebadge[i] = 0;
myEP = 0;
}
void init_badge() {
b(0, "EXACT NICE", 100000100); b(1, "EXACT JACKPOT", 100000100); b(2, "JACKPOT SIX", 100000100); b(3, "EXACT BOTANIST", 100000100); b(4, "EXACT DEVIL", 100000100);
b(5, "EXACT LEET", 100000100); b(6, "EXACT HELL", 100000100); b(7, "EXACT 80085", 100000100); b(8, "EXACT MEANING", 100000100); b(9, "EXACT EMERGENCY", 100000100);
b(10, "NOT FOUND", 100000100); b(11, "INFERNAL", 100000100); b(12, "17776", 100000100); b(13, "VERY VERY NICE", 100000100); b(14, "HOTBOX", 100000100);
b(15, "MAYDAY", 100000100); b(16, "UNIVERSAL ANSWER", 100000100); b(17, "ORWELLIAN", 100000100); b(18, "ZERO", 100000100); b(19, "ONE", 100000100);
b(20, "TWO", 100000100); b(21, "THREE", 100000100); b(22, "FOUR", 100000100); b(23, "FIVE", 100000100); b(24, "SIX", 100000100);
b(25, "SEVEN", 100000100); b(26, "EIGHT", 100000100); b(27, "NINE", 100000100); b(28, "EXACT SIX-SEVEN", 100000100); b(29, "EXACT EIGHTY-SIX", 100000100);
b(30, "EXACT ORIENTATION", 100000100); b(31, "EXACT CALENDAR", 100000100); b(32, "BRAINROT", 100000100); b(33, "GROUNDHOG DAY", 100000100); b(34, "FULL DAY", 100000100);
b(35, "ONE MILLION", 100000100); b(36, "EXACT BOOB", 50000050); b(37, "FUNNY NUMBER", 50000050); b(38, "ALWAYS", 50000050); b(39, "13TH POWER", 33333367);
b(40, "17TH POWER", 33333367); b(41, "19TH POWER", 33333367); b(42, "TAU", 33333367); b(43, "GOLDEN RATIO", 33333367); b(44, "10TH POWER", 25000025);
b(45, "11TH POWER", 25000025); b(46, "PI", 25000025); b(47, "EULER'S NUMBER", 25000025); b(48, "4 CONSECUTIVE NUMBERS", 25000025); b(49, "9TH POWER", 20000020);
b(50, "8TH POWER", 16666683); b(51, "OUROBOROS", 14285729); b(52, "7TH POWER", 12500013); b(53, "POWER OF SEVEN", 12500013); b(54, "POWER OF FIVE", 11111122);
b(55, "FACTORIAL", 11111122); b(56, "HELLO", 11111122); b(57, "SEQUENCE (6)", 11111122); b(58, "EON", 10000010); b(59, "CONTIGUOUS SIXES", 10000010);
b(60, "DEEP VOID (5)", 10000010); b(61, "SINGLE DIGIT", 10000010); b(62, "QUINT NINE", 10000010); b(63, "SEMI-EON", 10000010); b(64, "6TH POWER", 9090918);
b(65, "POWER OF THREE", 7692315); b(66, "5TH POWER", 6250006); b(67, "JACKPOT FIVE", 5263163); b(68, "POWER OF TWO", 5000005); b(69, "ROYAL FLUSH", 5000005);
b(70, "58008", 5000005); b(71, "80085", 5000005); b(72, "PI SLICE (5)", 5000005); b(73, "E SLICE (5)", 5000005); b(74, "TAU SLICE (5)", 5000005);
b(75, "CASCADE", 3333337); b(76, "FIBONACCI NUMBER", 3333337); b(77, "4TH POWER", 3125003); b(78, "WATERFALL", 2857146); b(79, "4 CONSECUTIVE NUMBERS (CONTAINS)", 2631582);
b(80, "4 CONSECUTIVE NUMBERS (SCRAMBLED)", 2272730); b(81, "HOMOGENEOUS", 2222224); b(82, "FUNNY NUMBERS", 1666668); b(83, "BINARY SOUL", 1538463); b(84, "STRAIGHT FLUSH", 1449277);
b(85, "TWO DIGITS", 1111112); b(86, "SPY NUMBER", 1030929); b(87, "EPOCH", 1000001); b(88, "QUAD NINE", 1000001); b(89, "SEMI-EPOCH", 1000001);
b(90, "3RD POWER", 990100); b(91, "EVEN SPACING", 862070); b(92, "3 CONSECUTIVE NUMBERS", 555556); b(93, "CONTIGUOUS FIVES", 552487); b(94, "DEEP VOID (4)", 552487);
b(95, "STROBOGRAMMATIC", 502513); b(96, "STRAIGHT", 454546); b(97, "JACKPOT FOUR", 357143); b(98, "VERY NICE", 334448); b(99, "DEEPER MEANING", 334448);
b(100, "6767", 334448); b(101, "LEET", 333334); b(102, "HELL", 333334); b(103, "8008", 333334); b(104, "BIG BROTHER", 333334);
b(105, "PI SLICE (4)", 333334); b(106, "E SLICE (4)", 333334); b(107, "TAU SLICE (4)", 333334); b(108, "3 CONSECUTIVE NUMBERS (SCRAMBLED)", 277778); b(109, "ZIPPER", 246914);
b(110, "ASCENSION", 219298); b(111, "CRESCENDO", 208334); b(112, "FIVE OF A KIND", 198020); b(113, "3 CONSECUTIVE NUMBERS (CONTAINS)", 157978); b(114, "CONTIGUOUS THREE PAIR", 154321);
b(115, "FRAMED PAIR", 137174); b(116, "FRAMED TRIPLE", 137174); b(117, "FRAMED QUAD", 137174); b(118, "DECAY", 119474); b(119, "THREE DIGITS", 111111);
b(120, "ECHO", 100100); b(121, "MILLENNIUM", 100000); b(122, "PRONIC NUMBER", 100000); b(123, "TRIPLE NINE", 100000); b(124, "SEMI-MILLENNIUM", 100000);
b(125, "COLOSSAL", 100000); b(126, "2ND POWER", 99900); b(127, "EVEN SPACING (ABSOLUTE)", 90992); b(128, "FIREFLY", 82237); b(129, "2 CONSECUTIVE NUMBERS", 50505);
b(130, "PALINDROME", 50025); b(131, "CONTIGUOUS QUADS", 37023); b(132, "DEEP VOID (3)", 37023); b(133, "TURTLE", 36049); b(134, "SECRET AGENT", 34614);
b(135, "HEAVY", 33300); b(136, "CONTIGUOUS FULL HOUSE", 30111); b(137, "JACKPOT", 27027); b(138, "DEVIL", 27027); b(139, "SEQUENCE (4)", 25907);
b(140, "ERROR 404", 25132); b(141, "ORIENTATION", 25132); b(142, "BOTANIST", 25006); b(143, "EMERGENCY", 25006); b(144, "PI SLICE (3)", 25006);
b(145, "E SLICE (3)", 25006); b(146, "CALENDAR", 25006); b(147, "DIVISIBLE BY THREE", 24414); b(148, "SCRAMBLE", 22722); b(149, "DUALITY", 21654);
b(150, "STEPS", 20202); b(151, "METRONOME", 17784); b(152, "FRAMED DOUBLE", 15242); b(153, "SLOPES", 12582); b(154, "PAIRED BOOKENDS", 11122);
b(155, "FOUR DIGITS", 11111); b(156, "THREE PAIR", 10288); b(157, "BOOKENDS", 10010); b(158, "MIRROR BOOKENDS", 10010); b(159, "CENTURY", 10000);
b(160, "DOUBLE NINE", 10000); b(161, "QUARTER-CENTURY", 10000); b(162, "SEMI-CENTURY", 10000); b(163, "THREE-QUARTER CENTURY", 10000); b(164, "FOUR OF A KIND", 8436);
b(165, "EQUATION", 7720); b(166, "LOW BALL", 6400); b(167, "MOUNTAIN", 5885); b(168, "DOUBLE HOP", 5321); b(169, "HIGH ROLLER", 5120);
b(170, "VALLEY", 4199); b(171, "CONTIGUOUS TWO PAIR", 3957); b(172, "MINI ECHO", 3704); b(173, "ALTERNATOR", 2845); b(174, "FLUSH", 2845);
b(175, "CONTIGUOUS TRIPS", 2784); b(176, "DEEP VOID", 2784); b(177, "FEATHER", 2667); b(178, "BLACKJACK", 2521); b(179, "FULL HOUSE", 2397);
b(180, "POCKET MIRROR", 2124); b(181, "SNAKE EYES", 2121); b(182, "NICE", 2024); b(183, "MEANING OF LIFE", 2024); b(184, "SIX-SEVEN", 2024);
b(185, "EIGHTY-SIX", 2024); b(186, "BALANCED", 1959); b(187, "RHYME", 1872); b(188, "SEQUENCE (3)", 1716); b(189, "2 CONSECUTIVE NUMBERS (CONTAINS)", 1659);
b(190, "2 CONSECUTIVE NUMBERS (NEARBY)", 1575); b(191, "MESA", 1568); b(192, "PRIME NUMBER", 1274); b(193, "TRINITY", 1265); b(194, "DOZEN", 1200);
b(195, "CANYON", 1184); b(196, "FIVE DIGITS", 1111); b(197, "ELEVEN", 1100); b(198, "HARSHAD NUMBER", 1048); b(199, "CLEAN", 1000);
b(200, "SEMI-CLEAN", 1000); b(201, "EQUILIBRIUM", 1000); b(202, "SANDWICH", 1000); b(203, "HILLS", 733); b(204, "THREE OF A KIND", 724);
b(205, "LUCKY SEVEN (DIVISIBLE)", 700); b(206, "HETEROGENEOUS", 593); b(207, "MINI SCRAMBLE", 579); b(208, "GAP ONE", 529); b(209, "TWO PAIR", 377);
b(210, "DUNES", 364); b(211, "HOPSCOTCH", 312); b(212, "GHOST", 309); b(213, "QUARTET", 290); b(214, "HYDROGEN (1)", 282);
b(215, "HELIUM (2)", 282); b(216, "CARBON (6)", 282); b(217, "OXYGEN (8)", 282); b(218, "LITHIUM (3)", 282); b(219, "BERYLLIUM (4)", 282);
b(220, "BORON (5)", 282); b(221, "NITROGEN (7)", 282); b(222, "FLUORINE (9)", 282); b(223, "GROUNDED", 250); b(224, "CONTIGUOUS PAIR", 249);
b(225, "LUCKY SEVEN", 213); b(226, "EVEN", 200); b(227, "ODD", 200); b(228, "LIFTOFF", 200); b(229, "VOID", 167);
b(230, "NEIGHBORS", 161); b(231, "PAIR", 120); b(232, "SIX DIGITS", 111);
clash[2] = {1}; clash[8] = {3}; clash[11] = {4}; clash[13] = {0}; clash[14] = {3, 8};
clash[15] = {9}; clash[19] = {18}; clash[20] = {18, 19}; clash[21] = {18, 19, 20};
clash[22] = {18, 19, 20, 21}; clash[23] = {18, 19, 20, 21, 22}; clash[24] = {18, 19, 20, 21, 22, 23};
clash[25] = {18, 19, 20, 21, 22, 23, 24}; clash[26] = {18, 19, 20, 21, 22, 23, 24, 25};
clash[27] = {18, 19, 20, 21, 22, 23, 24, 25, 26}; clash[32] = {28}; clash[33] = {31};
clash[36] = {7}; clash[38] = {31, 33}; clash[40] = {39}; clash[41] = {39, 40};
clash[44] = {39, 40, 41}; clash[45] = {39, 40, 41, 44}; clash[49] = {39, 40, 41, 44, 45};
clash[50] = {39, 40, 41, 44, 45, 49}; clash[51] = {39, 40, 41, 44, 45, 49, 50};
clash[52] = {39, 40, 41, 44, 45, 49, 50, 51}; clash[60] = {58};
clash[61] = {18, 19, 20, 21, 22, 23, 24, 25, 26, 27}; clash[63] = {58, 60};
clash[64] = {39, 40, 41, 44, 45, 49, 50, 51, 52}; clash[66] = {39, 40, 41, 44, 45, 49, 50, 51, 52, 64};
clash[67] = {1, 2}; clash[70] = {7, 36}; clash[71] = {7, 36, 70}; clash[72] = {46};
clash[73] = {47}; clash[74] = {42}; clash[75] = {57};
clash[77] = {39, 40, 41, 44, 45, 49, 50, 51, 52, 64, 66}; clash[78] = {57, 75};
clash[79] = {48}; clash[80] = {48, 79}; clash[82] = {37}; clash[84] = {69};
clash[87] = {58, 60, 63}; clash[88] = {62}; clash[89] = {58, 60, 63, 87};
clash[90] = {39, 40, 41, 44, 45, 49, 50, 51, 52, 64, 66, 77}; clash[91] = {57, 75, 78};
clash[92] = {48, 79, 80}; clash[93] = {59}; clash[94] = {58, 60, 63, 87, 89};
clash[96] = {69, 84}; clash[97] = {1, 2, 67}; clash[98] = {0, 13}; clash[99] = {16};
clash[100] = {28, 32}; clash[101] = {5}; clash[102] = {6}; clash[103] = {7, 36, 70, 71};
clash[104] = {17}; clash[105] = {46, 72}; clash[106] = {47, 73}; clash[107] = {42, 74};
clash[108] = {48, 79, 80, 92}; clash[111] = {57, 75, 78, 91}; clash[113] = {48, 79, 80, 92, 108};
clash[115] = {114}; clash[116] = {112}; clash[117] = {112, 116}; clash[118] = {110};
clash[121] = {58, 60, 63, 87, 89, 94}; clash[123] = {62, 88};
clash[124] = {58, 60, 63, 87, 89, 94, 121};
clash[126] = {39, 40, 41, 44, 45, 49, 50, 51, 52, 64, 66, 77, 90};
clash[127] = {57, 75, 78, 91, 111}; clash[129] = {48, 79, 80, 92, 108, 113};
clash[131] = {59, 93}; clash[132] = {58, 60, 63, 87, 89, 94, 121, 124};
clash[133] = {57, 75, 78, 91, 111, 127}; clash[137] = {1, 2, 67, 97}; clash[138] = {4, 11};
clash[139] = {57, 75, 78, 91, 111, 127, 133}; clash[140] = {10}; clash[141] = {30};
clash[142] = {3, 8, 14}; clash[143] = {9, 15}; clash[144] = {46, 72, 105};
clash[145] = {47, 73, 106}; clash[146] = {31, 33, 38};
clash[148] = {57, 75, 78, 91, 111, 127, 133, 139}; clash[149] = {128};
clash[150] = {110, 118}; clash[151] = {57, 75, 78, 91, 111, 127, 133, 139, 148};
clash[152] = {114, 115}; clash[153] = {110, 118, 150}; clash[156] = {114, 115, 152};
clash[157] = {154}; clash[158] = {154, 157};
clash[159] = {58, 60, 63, 87, 89, 94, 121, 124, 132}; clash[160] = {62, 88, 123};
clash[162] = {58, 60, 63, 87, 89, 94, 121, 124, 132, 159}; clash[164] = {112, 116, 117};
clash[170] = {167}; clash[171] = {114, 115, 152, 156}; clash[175] = {59, 93, 131};
clash[176] = {58, 60, 63, 87, 89, 94, 121, 124, 132, 159, 162}; clash[179] = {136};
clash[180] = {130}; clash[182] = {0, 13, 98}; clash[183] = {3, 8, 14, 142};
clash[184] = {28, 32, 100}; clash[185] = {29}; clash[187] = {172};
clash[188] = {57, 75, 78, 91, 111, 127, 133, 139, 148, 151};
clash[189] = {48, 79, 80, 92, 108, 113, 129};
clash[190] = {48, 79, 80, 92, 108, 113, 129, 189}; clash[191] = {167, 170};
clash[195] = {167, 170, 191};
clash[199] = {58, 60, 63, 87, 89, 94, 121, 124, 132, 159, 162, 176};
clash[202] = {201}; clash[204] = {112, 116, 117, 164};
clash[207] = {57, 75, 78, 91, 111, 127, 133, 139, 148, 151, 188};
clash[209] = {114, 115, 152, 156, 171}; clash[210] = {203}; clash[211] = {168};
clash[224] = {114, 115, 152, 156, 171, 209};
clash[231] = {114, 115, 152, 156, 171, 209, 224};
}
bool chk(int id) {
switch (id) {
case 0: return num == 69;
case 1: return num == 777;
case 2: return num == 777777;
case 3: return num == 420;
case 4: return num == 666;
case 5: return num == 1337;
case 6: return num == 7734;
case 7: return num == 80085;
case 8: return num == 42;
case 9: return num == 911;
case 10: return num == 404;
case 11: return num == 666666;
case 12: return num == 17776;
case 13: return num == 696969;
case 14: return num == 420420;
case 15: return num == 911911;
case 16: return num == 424242;
case 17: return num == 1984;
case 18: return num == 0;
case 19: return num == 1;
case 20: return num == 2;
case 21: return num == 3;
case 22: return num == 4;
case 23: return num == 5;
case 24: return num == 6;
case 25: return num == 7;
case 26: return num == 8;
case 27: return num == 9;
case 28: return num == 67;
case 29: return num == 86;
case 30: return num == 101;
case 31: return num == 365;
case 32: return num == 676767;
case 33: return num == 365365;
case 34: return num == 86400;
case 35: return num == 1000000;
case 36: return num == 8008 || num == 58008;
case 37: return num == 69420 || num == 42069;
case 38: return num == 247365 || num == 365247;
case 39: return num == 0 || num == 1 || num == 8192;
case 40: return num == 0 || num == 1 || num == 131072;
case 41: return num == 0 || num == 1 || num == 524288;
case 42: return num == 6283 || num == 62831 || num == 628318;
case 43: return num == 1618 || num == 16180 || num == 161803;
case 44: return num == 0 || num == 1 || num == 1024 || num == 59049;
case 45: return num == 0 || num == 1 || num == 2048 || num == 177147;
case 46: return num == 314 || num == 3141 || num == 31415 || num == 314159;
case 47: return num == 271 || num == 2718 || num == 27182 || num == 271828;
case 48: return num == 78910 || num == 891011 || num == 111098 || num == 10987;
case 49: return num == 0 || num == 1 || num == 512 || num == 19683 || num == 262144;
case 50: return num == 0 || num == 1 || num == 256 || num == 6561 || num == 65536 || num == 390625;
case 51: return num == 1 || num == 4 || num == 27 || num == 256 || num == 3125 || num == 46656 || num == 823543;
case 52: return num == 0 || num == 1 || num == 128 || num == 2187 || num == 16384 || num == 78125 || num == 279936 || num == 823543;
case 53: return num == 1 || num == 7 || num == 49 || num == 343 || num == 2401 || num == 16807 || num == 117649 || num == 823543;
case 54: return num == 1 || num == 5 || num == 25 || num == 125 || num == 625 || num == 3125 || num == 15625 || num == 78125 || num == 390625;
case 55: return num == 1 || num == 2 || num == 6 || num == 24 || num == 120 || num == 720 || num == 5040 || num == 40320 || num == 362880;
case 56: return subnum[5][0] == 7734;
case 57: return num == 123456 || num == 234567 || num == 345678 || num == 456789 || num == 987654 || num == 876543 || num == 765432 || num == 654321 || num == 543210;
case 58: return subnum[5][0] == 0;
case 59: return num == 111111 || num == 222222 || num == 333333 || num == 444444 || num == 555555 || num == 666666 || num == 777777 || num == 888888 || num == 999999 || num == 1000000;
case 60: return subnum[5][0] == 0;
case 61: return len == 1;
case 62: return subnum[5][0] == 99999;
case 63: return subnum[5][0] == 50000;
case 64: return num == 0 || num == 1 || num == 64 || num == 729 || num == 4096 || num == 15625 || num == 46656 || num == 117649 || num == 262144 || num == 531441 || num == 1000000;
case 65: return num == 1 || num == 3 || num == 9 || num == 27 || num == 81 || num == 243 || num == 729 || num == 2187 || num == 6561 || num == 19683 || num == 59049 || num == 177147 || num == 531441;
case 66: return num == 0 || num == 1 || num == 32 || num == 243 || num == 1024 || num == 3125 || num == 7776 || num == 16807 || num == 32768 || num == 59049 || num == 100000 || num == 161051 || num == 248832 || num == 371293 || num == 537824 || num == 759375;
case 67: return subnum[5][0] == 77777 || subnum[5][1] == 77777;
case 68: return num == 1 || num == 2 || num == 4 || num == 8 || num == 16 || num == 32 || num == 64 || num == 128 || num == 256 || num == 512 || num == 1024 || num == 2048 || num == 4096 || num == 8192 || num == 16384 || num == 32768 || num == 65536 || num == 131072 || num == 262144 || num == 524288;
case 69: return subnum[5][0] == 56789 || subnum[5][1] == 56789;
case 70: return subnum[5][0] == 58008 || subnum[5][1] == 58008;
case 71: return subnum[5][0] == 80085 || subnum[5][1] == 80085;
case 72: return subnum[5][0] == 31415 || subnum[5][1] == 31415;
case 73: return subnum[5][0] == 27182 || subnum[5][1] == 27182;
case 74: return subnum[5][0] == 62831 || subnum[5][1] == 62831;
case 75:
if (len == 1) return 0;
for (int i = 1; i < len; i++)
if (subnum[1][i] != subnum[1][i - 1] - 1) return 0;
return 1;
case 76: {
if (num == 0) return 1;
int x = 0, y = 1;
while (1) {
if (num == y) return 1;
int tmp = x; x = y; y += tmp;
if (y > INF) return 0;
}
}
case 77:
for (int i = 0; i * i * i * i <= INF; i++)
if (num == i * i * i * i) return 1;
return 0;
case 78:
if (len == 1) return 0;
for (int i = 1; i < len; i++)
if (subnum[1][i] != subnum[1][i - 1] + 1) return 0;
return 1;
case 79: return len == 6 && (subnum[5][0] == 78910 || subnum[5][1] == 78910 || subnum[5][0] == 10987 || subnum[5][1] == 10987);
case 80: return num == 78109 || num == 79810 || num == 79108 || num == 71089 || num == 71098 || num == 87910 || num == 87109 || num == 89710 || num == 89107 || num == 81079 || num == 81097 || num == 97810 || num == 97108 || num == 98710 || num == 98107 || num == 91078 || num == 91087 || num == 10789 || num == 10798 || num == 10879 || num == 10897 || num == 10978
|| num == 891110 || num == 810911 || num == 810119 || num == 811910 || num == 811109 || num == 981011 || num == 981110 || num == 910811 || num == 910118 || num == 911810 || num == 911108 || num == 108911 || num == 108119 || num == 109811 || num == 109118 || num == 101189 || num == 101198 || num == 118910 || num == 118109 || num == 119810 || num == 119108 || num == 111089;
case 81:
if (len == 1) return 0;
for (int i = 1; i < len; i++)
if (subnum[1][i] != subnum[1][0]) return 0;
return 1;
case 82: {
bool f1 = 0, f2 = 0;
for (int i = 0; i <= len - 2; i++) if (subnum[2][i] == 69) { f1 = 1; break; }
for (int i = 0; i <= len - 3; i++) if (subnum[3][i] == 420) { f2 = 1; break; }
return f1 && f2;
}
case 83:
for (int i = 0; i < len; i++) if (subnum[1][i] > 1) return 0;
return 1;
case 84:
for (int i = 0; i <= len - 5; i++)
if (subnum[5][i] == 13579 || subnum[5][i] == 97531 || subnum[5][i] == 2468 || subnum[5][i] == 24680 || subnum[5][i] == 86420) return 1;
return 0;
case 85: return len == 2;
case 86: {
int sum = 0, prod = 1;
for (int i = 0; i < len; i++) sum += subnum[1][i], prod *= subnum[1][i];
return sum == prod;
}
case 87: return subnum[4][0] == 0;
case 88: return subnum[4][0] == 9999;
case 89: return subnum[4][0] == 5000;
case 90:
for (int i = 0; i * i * i <= INF; i++)
if (num == i * i * i) return 1;
return 0;
case 91:
if (len <= 2) return 0;
for (int i = 2; i < len; i++)
if (subnum[1][i] - subnum[1][i - 1] != subnum[1][i - 1] - subnum[1][i - 2]) return 0;
return 1;
case 92:
if (num == 8910 || num == 91011 || num == 11109 || num == 1098) return 1;
if (len != 6) return 0;
return subnum[2][2] >= 10 && subnum[2][0] >= 10 && ((subnum[2][2] == subnum[2][4] + 1 && subnum[2][0] == subnum[2][2] + 1) || (subnum[2][2] == subnum[2][4] - 1 && subnum[2][0] == subnum[2][2] - 1));
case 93:
for (int i = 0; i <= len - 5; i++)
if (subnum[5][i] % 11111 == 0 && subnum[5][i] > 0) return 1;
return 0;
case 94: return subnum[4][0] == 0 || subnum[4][1] == 0;
case 95: {
int rot[10] = {0, 1, -1, -1, -1, -1, 9, -1, 8, 6};
for (int i = 0; i <= len / 2; i++)
if (rot[subnum[1][i]] != subnum[1][len - 1 - i]) return 0;
return 1;
}
case 96:
for (int i = 0; i <= len - 5; i++)
if (subnum[5][i] == 12345 || subnum[5][i] == 23456 || subnum[5][i] == 34567 || subnum[5][i] == 45678 || subnum[5][i] == 56789 || subnum[5][i] == 98765 || subnum[5][i] == 87654 || subnum[5][i] == 76543 || subnum[5][i] == 65432 || subnum[5][i] == 54321 || subnum[5][i] == 43210)
return 1;
return 0;
case 97: return subnum[4][0] == 7777 || subnum[4][1] == 7777 || subnum[4][2] == 7777;
case 98: return subnum[4][0] == 6969 || subnum[4][1] == 6969 || subnum[4][2] == 6969;
case 99: return subnum[4][0] == 4242 || subnum[4][1] == 4242 || subnum[4][2] == 4242;
case 100: return subnum[4][0] == 6767 || subnum[4][1] == 6767 || subnum[4][2] == 6767;
case 101: return subnum[4][0] == 1337 || subnum[4][1] == 1337 || subnum[4][2] == 1337;
case 102: return subnum[4][0] == 7734 || subnum[4][1] == 7734 || subnum[4][2] == 7734;
case 103: return subnum[4][0] == 8008 || subnum[4][1] == 8008 || subnum[4][2] == 8008;
case 104: return subnum[4][0] == 1984 || subnum[4][1] == 1984 || subnum[4][2] == 1984;
case 105: return subnum[4][0] == 3141 || subnum[4][1] == 3141 || subnum[4][2] == 3141;
case 106: return subnum[4][0] == 2718 || subnum[4][1] == 2718 || subnum[4][2] == 2718;
case 107: return subnum[4][0] == 6283 || subnum[4][1] == 6283 || subnum[4][2] == 6283;
case 108: {
if (len != 6) return 0;
int a[3] = {subnum[2][0], subnum[2][2], subnum[2][4]};
sort(a, a + 3);
return a[0] >= 10 && a[1] == a[0] + 1 && a[2] == a[1] + 1;
}
case 109: {
if (len < 5) return 0;
bool oddSame = 1, evenSame = 1, oddSeq = 1, evenSeq = 1;
for (int i = 2; i < len; i += 2) {
if (subnum[1][i] != subnum[1][0]) evenSame = 0;
if (abs(subnum[1][i] - subnum[1][i - 2]) != 1) evenSeq = 0;
}
for (int i = 3; i < len; i += 2) {
if (subnum[1][i] != subnum[1][1]) oddSame = 0;
if (abs(subnum[1][i] - subnum[1][i - 2]) != 1) oddSeq = 0;
}
return (evenSame && oddSeq) || (oddSame && evenSeq);
}
case 110: {
if (len < 2) return 0;
for (int i = 0; i < len - 1; i++)
if (subnum[1][i + 1] >= subnum[1][i]) return 0;
return 1;
}
case 111: {
if (len < 4) return 0;
for (int i = len - 1; i >= 2; i--)
if ((subnum[1][i - 2] - subnum[1][i - 1]) != (subnum[1][i - 1] - subnum[1][i]) + 1) return 0;
return 1;
}
case 112: { for (int d = 0; d < 10; d++) if (cnt[d] >= 5) return 1; return 0; }
case 113: {
for (int i = 0; i <= len - 4; i++)
if (subnum[4][i] == 8910 || subnum[4][i] == 1098) return 1;
for (int i = 0; i <= len - 5; i++)
if (subnum[5][i] == 91011 || subnum[5][i] == 11109) return 1;
return 0;
}
case 114: return len == 6 && subnum[1][0] == subnum[1][1] && subnum[1][2] == subnum[1][3] && subnum[1][4] == subnum[1][5];
case 115:
if (len == 4) return subnum[1][0] == subnum[1][3] && subnum[1][1] == subnum[1][2];
if (len == 6) return subnum[1][0] == subnum[1][5] && subnum[1][1] == subnum[1][2] && subnum[1][3] == subnum[1][4];
return 0;
case 116: return len == 5 && subnum[1][0] == subnum[1][4] && subnum[1][1] == subnum[1][2] && subnum[1][2] == subnum[1][3];
case 117: return len == 6 && subnum[1][0] == subnum[1][5] && subnum[1][1] == subnum[1][2] && subnum[1][2] == subnum[1][3] && subnum[1][3] == subnum[1][4];
case 118: {
if (len < 2) return 0;
for (int i = 0; i < len - 1; i++)
if (subnum[1][i + 1] <= subnum[1][i]) return 0;
return 1;
}
case 119: return len == 3;
case 120: return len >= 4 && len % 2 == 0 && subnum[len / 2][0] == subnum[len / 2][len / 2];
case 121: return subnum[3][0] == 0;
case 122: { int r = sqrt(num); return r * (r + 1) == num; }
case 123: return subnum[3][0] == 999;
case 124: return subnum[3][0] == 500;
case 125: return num >= 999000;
case 126: { int r = round(sqrt(num)); return r * r == num; }
case 127: {
if (len < 3) return 0;
int diff = abs(subnum[1][1] - subnum[1][0]);
if (diff == 0) return 0;
for (int i = 2; i < len; i++)
if (abs(subnum[1][i] - subnum[1][i - 1]) != diff) return 0;
return 1;
}
case 128: {
if (len < 4 || distinct != 2) return 0;
for (int d = 0; d < 10; d++) if (cnt[d] == 1) return 1;
return 0;
}
case 129:
if (len == 6 && subnum[3][0] >= 100) return abs(subnum[3][3] - subnum[3][0]) == 1;
if (len == 4 && subnum[2][0] >= 10) return abs(subnum[2][2] - subnum[2][0]) == 1;
return 0;
case 130: {
if (len < 2) return 0;
for (int i = 0; i < len / 2; i++)
if (subnum[1][i] != subnum[1][len - 1 - i]) return 0;
return 1;
}
case 131: {
for (int i = 0; i <= len - 4; i++)
if (subnum[1][i] == subnum[1][i + 1] && subnum[1][i] == subnum[1][i + 2] && subnum[1][i] == subnum[1][i + 3]) return 1;
return 0;
}
case 132: {
for (int i = 0; i <= len - 3; i++)
if (subnum[1][i] == 0 && subnum[1][i + 1] == 0 && subnum[1][i + 2] == 0) return 1;
return 0;
}
case 133: {
if (len < 4) return 0;
for (int i = 1; i < len; i++)
if (abs(subnum[1][i] - subnum[1][i - 1]) > 1) return 0;
return 1;
}
case 134: {
for (int i = 0; i <= len - 3; i++)
if (subnum[1][i] == 7 && subnum[1][i + 1] == 0 && subnum[1][i + 2] == 0) return 1;
return 0;
}
case 135: return dsum >= 44;
case 136:
if (len == 5) return (subnum[1][0] == subnum[1][1] && subnum[1][2] == subnum[1][3] && subnum[1][3] == subnum[1][4]) ||
(subnum[1][0] == subnum[1][1] && subnum[1][1] == subnum[1][2] && subnum[1][3] == subnum[1][4]);
if (len == 6) return subnum[1][0] == subnum[1][1] && subnum[1][1] == subnum[1][2] && subnum[1][3] == subnum[1][4] && subnum[1][4] == subnum[1][5];
return 0;
case 137: { for (int i = 0; i <= len - 3; i++) if (subnum[3][i] == 777) return 1; return 0; }
case 138: { for (int i = 0; i <= len - 3; i++) if (subnum[3][i] == 666) return 1; return 0; }
case 139: {
for (int i = 0; i <= len - 4; i++) {
int d1 = subnum[1][i + 3] - subnum[1][i + 2];
int d2 = subnum[1][i + 2] - subnum[1][i + 1];
int d3 = subnum[1][i + 1] - subnum[1][i];
if (abs(d1) == 1 && d1 == d2 && d2 == d3) return 1;
}
return 0;
}
case 140: { for (int i = 0; i <= len - 3; i++) if (subnum[3][i] == 404) return 1; return 0; }
case 141: { for (int i = 0; i <= len - 3; i++) if (subnum[3][i] == 101) return 1; return 0; }
case 142: { for (int i = 0; i <= len - 3; i++) if (subnum[3][i] == 420) return 1; return 0; }
case 143: { for (int i = 0; i <= len - 3; i++) if (subnum[3][i] == 911) return 1; return 0; }
case 144: { for (int i = 0; i <= len - 3; i++) if (subnum[3][i] == 314) return 1; return 0; }
case 145: { for (int i = 0; i <= len - 3; i++) if (subnum[3][i] == 271) return 1; return 0; }
case 146: { for (int i = 0; i <= len - 3; i++) if (subnum[3][i] == 365) return 1; return 0; }
case 147: { for (int i = 0; i < len; i++) if (subnum[1][i] % 3 != 0) return 0; return 1; }
case 148: {
if (len < 5 || distinct != len) return 0;
int mn = 9, mx = 0;
for (int i = 0; i < len; i++) mn = min(mn, subnum[1][i]), mx = max(mx, subnum[1][i]);
return mx - mn == len - 1;
}
case 149: return len >= 3 && distinct == 2;
case 150: {
if (len < 3) return 0;
bool inc = 1, dec = 1;
for (int i = 0; i < len - 1; i++) {
if (subnum[1][i + 1] > subnum[1][i]) inc = 0;
if (subnum[1][i + 1] < subnum[1][i]) dec = 0;
}
return inc || dec;
}
case 151: {
if (len < 4) return 0;
for (int i = 2; i < len; i++)
if (subnum[1][i] - subnum[1][i - 1] != -(subnum[1][i - 1] - subnum[1][i - 2])) return 0;
return 1;
}
case 152: {
if (len < 4 || subnum[1][0] != subnum[1][len - 1]) return 0;
for (int i = 1; i < len - 2; i++)
if (subnum[1][i] == subnum[1][i + 1]) return 1;
return 0;
}
case 153:
return len == 6 && ((subnum[2][4] < subnum[2][2] && subnum[2][2] < subnum[2][0]) ||
(subnum[2][4] > subnum[2][2] && subnum[2][2] > subnum[2][0]));
case 154: return len >= 4 && subnum[1][0] == subnum[1][1] && subnum[1][len - 1] == subnum[1][len - 2];
case 155: return len == 4;
case 156: {
if (len != 6) return 0;
int pairs = 0;
for (int d = 0; d < 10; d++) if (cnt[d] == 2) pairs++;
return pairs == 3;
}
case 157: return len >= 4 && subnum[2][0] == subnum[2][len - 2];
case 158: return len >= 4 && subnum[1][0] == subnum[1][len - 1] && subnum[1][1] == subnum[1][len - 2];
case 159: return subnum[2][0] == 0;
case 160: return subnum[2][0] == 99;
case 161: return subnum[2][0] == 25;
case 162: return subnum[2][0] == 50;
case 163: return subnum[2][0] == 75;
case 164: { for (int d = 0; d < 10; d++) if (cnt[d] >= 4) return 1; return 0; }
case 165: {
if (len != 6) return 0;
int a = subnum[2][4], b = subnum[2][2], c = subnum[2][0];
return a + b == c || a - b == c || a * b == c;
}
case 166: { for (int i = 0; i < len; i++) if (subnum[1][i] >= 5) return 0; return 1; }
case 167: {
if (len < 3) return 0;
int p = len - 1;
while (p > 0 && subnum[1][p - 1] > subnum[1][p]) p--;
if (p == len - 1 || p == 0) return 0;
while (p > 0 && subnum[1][p - 1] < subnum[1][p]) p--;
return p == 0;
}
case 168: {
int hops = 0;
for (int i = 0; i <= len - 3; i++) if (subnum[1][i] == subnum[1][i + 2]) hops++;
return hops >= 2;
}
case 169: { for (int i = 0; i < len; i++) if (subnum[1][i] < 5) return 0; return 1; }
case 170: {
if (len < 3) return 0;
int p = len - 1;
while (p > 0 && subnum[1][p - 1] < subnum[1][p]) p--;
if (p == len - 1 || p == 0) return 0;
while (p > 0 && subnum[1][p - 1] > subnum[1][p]) p--;
return p == 0;
}
case 171: {
for (int i = 0; i <= len - 4; i++)
if (subnum[1][i] == subnum[1][i + 1] && subnum[1][i + 2] == subnum[1][i + 3]) return 1;
return 0;
}
case 172: {
for (int i = 0; i <= len - 4; i++)
if (subnum[2][i] == subnum[2][i + 2] && subnum[1][i + 3] != 0) return 1;
return 0;
}
case 173: {
if (len < 2) return 0;
for (int i = 1; i < len; i++)
if (subnum[1][i] % 2 == subnum[1][i - 1] % 2) return 0;
return 1;
}
case 174: {
if (len < 2) return 0;
for (int i = 1; i < len; i++)
if (subnum[1][i] % 2 != subnum[1][0] % 2) return 0;
return 1;
}
case 175: {
for (int i = 0; i <= len - 3; i++)
if (subnum[1][i] == subnum[1][i + 1] && subnum[1][i] == subnum[1][i + 2]) return 1;
return 0;
}
case 176: {
for (int i = 0; i <= len - 2; i++)
if (subnum[1][i] == 0 && subnum[1][i + 1] == 0) return 1;
return 0;
}
case 177: return dsum <= 12;
case 178: return dsum == 21;
case 179: {
bool has3 = 0, has2 = 0;
for (int d = 0; d < 10; d++) {
if (cnt[d] == 3) { if (has3) has2 = 1; else has3 = 1; }
else if (cnt[d] == 2) has2 = 1;
}
return has3 && has2;
}
case 180: {
for (int i = 0; i <= len - 4; i++)
if (subnum[1][i] == subnum[1][i + 3] && subnum[1][i + 1] == subnum[1][i + 2]) return 1;
return 0;
}
case 181: { for (int i = 0; i <= len - 2; i++) if (subnum[2][i] == 11) return 1; return 0; }
case 182: { for (int i = 0; i <= len - 2; i++) if (subnum[2][i] == 69) return 1; return 0; }
case 183: { for (int i = 0; i <= len - 2; i++) if (subnum[2][i] == 42) return 1; return 0; }
case 184: { for (int i = 0; i <= len - 2; i++) if (subnum[2][i] == 67) return 1; return 0; }
case 185: { for (int i = 0; i <= len - 2; i++) if (subnum[2][i] == 86) return 1; return 0; }
case 186: {
if (len < 2 || len % 2 != 0) return 0;
int s1 = 0, s2 = 0;
for (int i = 0; i < len / 2; i++) s1 += subnum[1][i], s2 += subnum[1][i + len / 2];
return s1 == s2;
}
case 187: {
for (int i = 0; i <= len - 2; i++)
for (int j = i + 2; j <= len - 2; j++)
if (subnum[1][i] == subnum[1][j] && subnum[1][i + 1] == subnum[1][j + 1]) return 1;
return 0;
}
case 188: {
for (int i = 0; i <= len - 3; i++) {
int d1 = subnum[1][i + 2] - subnum[1][i + 1];
int d2 = subnum[1][i + 1] - subnum[1][i];
if (abs(d1) == 1 && d1 == d2) return 1;
}
return 0;
}
case 189: {
for (int i = 0; i <= len - 4; i++)
if (subnum[2][i + 2] >= 10 && subnum[2][i] >= 10 && abs(subnum[2][i + 2] - subnum[2][i]) == 1) return 1;
return 0;
}
case 190: return len == 6 && subnum[2][4] >= 10 && subnum[2][0] >= 10 && abs(subnum[2][4] - subnum[2][0]) == 1;
case 191: {
if (len < 4) return 0;
int p = len - 1;
while (p > 0 && subnum[1][p - 1] >= subnum[1][p]) p--;
if (p == len - 1 || p == 0) return 0;
while (p > 0 && subnum[1][p - 1] <= subnum[1][p]) p--;
return p == 0 && subnum[1][len - 1] < subnum[1][len / 2] && subnum[1][0] < subnum[1][len / 2];
}
case 192: {
if (num < 2) return 0;
for (int i = 2; i * i <= num; i++) if (num % i == 0) return 0;
return 1;
}
case 193: return len >= 4 && distinct == 3;
case 194: return num % 12 == 0;
case 195: {
if (len < 4) return 0;
int p = len - 1;
while (p > 0 && subnum[1][p - 1] <= subnum[1][p]) p--;
if (p == len - 1 || p == 0) return 0;
while (p > 0 && subnum[1][p - 1] >= subnum[1][p]) p--;
return p == 0 && subnum[1][len - 1] > subnum[1][len / 2] && subnum[1][0] > subnum[1][len / 2];
}
case 196: return len == 5;
case 197: return num % 11 == 0;
case 198: return dsum > 0 && num % dsum == 0;
case 199: return num % 10 == 0;
case 200: return num % 10 == 5;
case 201: return len >= 2 && subnum[1][0] == subnum[1][len - 1];
case 202: return len >= 3 && subnum[1][0] + subnum[1][len - 1] == 10;
case 203: {
if (len < 4) return 0;
for (int i = 2; i < len; i++) {
int d1 = subnum[1][i] - subnum[1][i - 1];
int d2 = subnum[1][i - 1] - subnum[1][i - 2];
if (d1 * d2 >= 0) return 0;
}
return 1;
}
case 204: { for (int d = 0; d < 10; d++) if (cnt[d] >= 3) return 1; return 0; }
case 205: return num % 7 == 0;
case 206: return distinct == len;
case 207: {
for (int i = 0; i <= len - 4; i++) {
int a[4] = {subnum[1][i], subnum[1][i + 1], subnum[1][i + 2], subnum[1][i + 3]};
sort(a, a + 4);
if (a[1] == a[0] + 1 && a[2] == a[1] + 1 && a[3] == a[2] + 1) return 1;
}
return 0;
}
case 208: return len >= 2 && abs(subnum[1][0] - subnum[1][len - 1]) == 1;
case 209: {
int p = 0;
for (int d = 0; d < 10; d++) p += cnt[d] / 2;
return p >= 2;
}
case 210: {
int turns = 0;
for (int i = 1; i < len - 1; i++) {
if ((subnum[1][i] > subnum[1][i - 1] && subnum[1][i] > subnum[1][i + 1]) ||
(subnum[1][i] < subnum[1][i - 1] && subnum[1][i] < subnum[1][i + 1])) turns++;
}
return turns >= 2;
}
case 211: {
for (int i = 0; i <= len - 3; i++)
if (subnum[1][i] == subnum[1][i + 2]) return 1;
return 0;
}
case 212: { for (int i = 1; i < len; i++) if (subnum[1][i] == 0) return 1; return 0; }
case 213: return len >= 5 && distinct == 4;
case 214: return cnt[1] == 1;
case 215: return cnt[2] == 1;
case 216: return cnt[6] == 1;
case 217: return cnt[8] == 1;
case 218: return cnt[3] == 1;
case 219: return cnt[4] == 1;
case 220: return cnt[5] == 1;
case 221: return cnt[7] == 1;
case 222: return cnt[9] == 1;
case 223: return subnum[1][0] < 4;
case 224: {
for (int i = 0; i < len - 1; i++)
if (subnum[1][i] == subnum[1][i + 1]) return 1;
return 0;
}
case 225: return cnt[7] > 0;
case 226: return num % 2 == 0;
case 227: return num % 2 == 1;
case 228: return subnum[1][0] > subnum[1][len - 1];
case 229: return cnt[0] > 0;
case 230: {
for (int i = 0; i < len - 1; i++)
if (abs(subnum[1][i] - subnum[1][i + 1]) == 1) return 1;
return 0;
}
case 231: return distinct < len;
case 232: return len == 6;
default: return 0;
}
}
void PrintRank(long long ep) {
if (ep >= 100000000) { SetColor(15, 4); cout << " GODLIKE "; }
else if (ep >= 10000000) { SetColor(15, 12); cout << " SSS "; }
else if (ep >= 1000000) { SetColor(0, 14); cout << " SS "; }
else if (ep >= 100000) { SetColor(15, 5); cout << " S "; }
else if (ep >= 25000) { SetColor(15, 1); cout << " A "; }
else if (ep >= 5000) { SetColor(0, 10); cout << " B "; }
else { SetColor(7, 0); cout << " [C] "; }
SetColor(7, 0);
}
// 绘制底部双栏历史得分面板(最近记录 + 历史Top 5名人堂)
void DrawHistoryPanel() {
SetColor(11, 0);
cout << "\n +------------------------------------+-------------------------------------+\n";
cout << " | ";
SetColor(15, 0); cout << " RECENT ROLLS (LAST 5) ";
SetColor(11, 0); cout << " | ";
SetColor(14, 0); cout << " HALL OF FAME (TOP 5 HIGH SCORES)";
SetColor(11, 0); cout << " |\n";
cout << " +------------------------------------+-------------------------------------+\n";
int rows = max((int)recentHistory.size(), (int)topHistory.size());
if (rows == 0) rows = 1;
for (int r = 0; r < rows; r++) {
SetColor(11, 0); cout << " | ";
// 左栏:最近记录
if (r < (int)recentHistory.size()) {
RollRecord &rec = recentHistory[r];
if (rec.mode == 'D') SetColor(14, 0);
else if (rec.mode == 'C') SetColor(13, 0);
else SetColor(11, 0);
cout << "[" << rec.mode << "] ";
SetColor(15, 0);
string numStr = "#" + IntToStr(rec.number);
cout << left << setw(9) << numStr;
string epStr = "+" + FormatNum(rec.score) + " EP";
if (rec.score >= 10000000) SetColor(12, 0);
else if (rec.score >= 1000000) SetColor(14, 0);
else if (rec.score >= 100000) SetColor(13, 0);
else SetColor(10, 0);
cout << right << setw(21) << epStr;
} else {
SetColor(8, 0);
cout << left << setw(34) << " (No records yet)";
}
SetColor(11, 0); cout << " | ";
// 右栏:历史最高分 Top 5
if (r < (int)topHistory.size()) {
RollRecord &top = topHistory[r];
if (r == 0) SetColor(12, 0);
else if (r == 1) SetColor(14, 0);
else if (r == 2) SetColor(13, 0);
else SetColor(7, 0);
cout << (r + 1) << ". ";
if (top.mode == 'D') SetColor(14, 0);
else SetColor(11, 0);
cout << "[" << top.mode << "] ";
SetColor(15, 0);
string numStr = "#" + IntToStr(top.number);
cout << left << setw(8) << numStr;
string epStr = "+" + FormatNum(top.score) + " EP";
if (top.score >= 10000000) SetColor(12, 0);
else if (top.score >= 1000000) SetColor(14, 0);
else SetColor(10, 0);
cout << right << setw(20) << epStr;
} else {
SetColor(8, 0);
cout << left << setw(35) << " ---";
}
SetColor(11, 0); cout << " |\n";
}
cout << " +------------------------------------+-------------------------------------+\n";
}
int PromptCustomNumber() {
DrawHeader(true);
ShowCursor(true);
SetColor(13, 0);
cout << " +--------------------------------------------------------------------------+\n";
cout << " | ";
SetColor(15, 0);
cout << "Enter a number to evaluate (0 ~ 1,000,000): ";
SetColor(13, 0);
cout << "|\n";
cout << " +--------------------------------------------------------------------------+\n";
GotoXY(48, 8);
SetColor(14, 0);
string input;
getline(cin, input);
ShowCursor(false);
long long val = 0;
bool hasDigit = false;
for (size_t i = 0; i < input.size(); i++) {
if (input[i] >= '0' && input[i] <= '9') {
hasDigit = true;
val = val * 10 + (input[i] - '0');
if (val > INF) { val = INF; break; }
}
}
if (!hasDigit) return 777777;
return (int)val;
}
int main() {
SetConsoleTitleA("RNGDLE Deluxe - C++ Edition");
ShowCursor(false);
init_badge();
ResetDailySeed();
int customTarget = -1;
while (1) {
bool isCustom = (customTarget != -1);
DrawHeader(isCustom);
num = RollSlotMachine(customTarget);
customTarget = -1;
init();
for (int i = 0; i < BADGE_NUM; i++) {
bool f = 1;
for (size_t j = 0; j < clash[i].size(); j++) {
if (havebadge[clash[i][j]]) f = 0;
}
if (!f) continue;
if (chk(i)) havebadge[i] = 1;
}
// 绘制结算表格头
SetColor(11, 0);
cout << " +--------------+------------------------------------+----------------------+\n";
cout << " | ";
SetColor(15, 0); cout << "RARITY TIER ";
SetColor(11, 0); cout << "| ";
SetColor(15, 0); cout << "BADGE NAME ";
SetColor(11, 0); cout << "| ";
SetColor(15, 0); cout << "REWARD VALUE ";
SetColor(11, 0); cout << "|\n";
cout << " +--------------+------------------------------------+----------------------+\n";
bool skipReveal = fastMode;
int badgeCount = 0;
for (int i = BADGE_NUM - 1; i >= 0; i--) {
if (havebadge[i]) {
badgeCount++;
string tier;
int textCol, badgeFg, badgeBg, waitTime;
if (i < 64) { textCol = 12; badgeFg = 15; badgeBg = 4; tier = " * MYTHIC "; waitTime = 850; }
else if (i < 90) { textCol = 14; badgeFg = 0; badgeBg = 14; tier = " # LEGEND "; waitTime = 650; }
else if (i < 126) { textCol = 13; badgeFg = 15; badgeBg = 5; tier = " + EPIC "; waitTime = 450; }
else if (i < 164) { textCol = 9; badgeFg = 15; badgeBg = 1; tier = " > RARE "; waitTime = 300; }
else if (i < 203) { textCol = 10; badgeFg = 0; badgeBg = 2; tier = " - UNCOMMON "; waitTime = 180; }
else { textCol = 7; badgeFg = 7; badgeBg = 0; tier = " . COMMON "; waitTime = 100; }
if (!skipReveal && i < 90) {
COORD cur = GetCursorPos();
for (int f = 0; f < 4; f++) {
GotoXY(0, cur.Y);
SetColor(11, 0); cout << " | ";
if (f % 2 == 0) SetColor(15, badgeBg);
else SetColor(textCol, 0);
cout << ">>> H I G H R A R I T Y D E T E C T E D <<< ";
SetColor(11, 0); cout << "|";
Sleep(75);
}
GotoXY(0, cur.Y);
}
SetColor(11, 0); cout << " | ";
SetColor(badgeFg, badgeBg); cout << tier;
SetColor(11, 0); cout << " | ";
SetColor(textCol, 0); cout << left << setw(34) << name[i];
SetColor(11, 0); cout << " | ";
SetColor(textCol, 0);
string epStr = "+" + FormatNum(EP[i]) + " EP";
cout << right << setw(20) << epStr;
SetColor(11, 0); cout << " |\n";
myEP += EP[i];
if (!skipReveal && SmartSleep(waitTime)) skipReveal = true;
}
}
// 更新生涯、每日种子、以及底部历史榜单数据
char curMode = isCustom ? 'C' : (dailyMode ? 'D' : 'N');
RecordHistory(num, myEP, curMode);
if (!isCustom) {
totalRolls++;
if (myEP > bestEP) {
bestEP = myEP;
bestNum = num;
}
if (dailyMode) {
if (myEP > dailyBestEP) {
dailyBestEP = myEP;
dailyBestNum = num;
}
if (dailyRollCount <= 5) {
daily5TotalEP += myEP;
}
}
}
// 表格底部与总分滚动结算
SetColor(11, 0);
cout << " +==============+====================================+======================+\n";
cout << " | ";
SetColor(15, 0); cout << "RANK: ";
PrintRank(myEP);
SetColor(7, 0); cout << " Badges Unlocked: ";
SetColor(15, 0); cout << left << setw(13) << badgeCount;
SetColor(11, 0); cout << "| ";
COORD scorePos = GetCursorPos();
SetColor(11, 0); cout << " |\n";
cout << " +===================================================+======================+\n";
int rollSteps = skipReveal ? 1 : 18;
for (int step = 1; step <= rollSteps; step++) {
long long cur = myEP * step / rollSteps;
string s = FormatNum(cur) + " EP";
GotoXY(scorePos.X, scorePos.Y);
SetColor(14, 0);
cout << right << setw(20) << s;
if (!skipReveal) Sleep(20);
}
GotoXY(0, scorePos.Y + 2);
// 渲染底部双栏历史记录与高分榜
DrawHistoryPanel();
// 底部快捷键提示栏
SetColor(8, 0);
cout << " +--------------------------------------------------------------------------+\n";
cout << " | ";
SetColor(0, 15); cout << " SP "; SetColor(7, 0); cout << " Roll ";
SetColor(0, 14); cout << " D "; SetColor(7, 0); cout << " Daily Seed ";
SetColor(0, 11); cout << " R "; SetColor(7, 0); cout << " Reset Daily ";
SetColor(15, 5); cout << " I "; SetColor(7, 0); cout << " Input ";
SetColor(0, 10); cout << " F "; SetColor(7, 0); cout << " Fast ";
SetColor(15, 4); cout << " Q "; SetColor(7, 0); cout << " Quit";
SetColor(8, 0);
cout << "|\n";
cout << " +--------------------------------------------------------------------------+\n";
while (_kbhit()) _getch();
while (true) {
int ch = _getch();
if (ch == '\r' || ch == ' ') {
break;
} else if (ch == 'd' || ch == 'D') {
dailyMode = !dailyMode;
break;
} else if (ch == 'r' || ch == 'R') {
ResetDailySeed();
dailyMode = true;
break;
} else if (ch == 'i' || ch == 'I') {
customTarget = PromptCustomNumber();
break;
} else if (ch == 'f' || ch == 'F') {
fastMode = !fastMode;
break;
} else if (ch == 'q' || ch == 'Q' || ch == 27) {
system("cls");
SetColor(7, 0);
return 0;
}
}
}
}