- 五位数倒序组合判断质数
针对邪恶脆脆虾小计划(旁观者勿入)
- @ 2026-4-1 21:24:26
! happy
4 条评论
-
我都可以 @ 2026-4-20 16:37:22https://oj.qdturing.cn/d/A1002/homework/69e1cb46c471ea99f2f94c92 -
@ 2026-4-6 9:31:02小柏然,你这连在c++运行都运行不了
-
@ 2026-4-4 16:07:401.3.19
#include <iostream> #include <cstdlib> #include <ctime> #include <windows.h> #include <vector> #include <string> #include <cstdint> #include <cstdio> #include <cstring> using namespace std; typedef uint8_t BYTE; typedef uint32_t WORD32; #define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b)))) #define ROTRIGHT(a,b) (((a) >> (b)) | ((a) << (32-(b)))) #define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) #define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) #define EP0(x) (ROTRIGHT(x,2) ^ ROTRIGHT(x,13) ^ ROTRIGHT(x,22)) #define EP1(x) (ROTRIGHT(x,6) ^ ROTRIGHT(x,11) ^ ROTRIGHT(x,15)) #define SIG0(x) (ROTRIGHT(x,7) ^ ROTRIGHT(x,18) ^ ((x) >> 3)) #define SIG1(x) (ROTRIGHT(x,17) ^ ROTRIGHT(x,19) ^ ((x) >> 10)) const WORD32 k[64] = { 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174, 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da, 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967, 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85, 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070, 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3, 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 }; typedef struct { BYTE data[64]; WORD32 datalen; uint64_t bitlen; WORD32 state[8]; } SHA256_CTX; void sha256_transform(SHA256_CTX *ctx, const BYTE data[]) { WORD32 a, b, c, d, e, f, g, h, i, j, t1, t2, m[64]; for (i = 0, j = 0; i < 16; ++i, j += 4) m[i] = (data[j] << 24) | (data[j+1] << 16) | (data[j+2] << 8) | (data[j+3]); for (; i < 64; ++i) m[i] = SIG1(m[i-2]) + m[i-7] + SIG0(m[i-15]) + m[i-16]; a = ctx->state[0]; b = ctx->state[1]; c = ctx->state[2]; d = ctx->state[3]; e = ctx->state[4]; f = ctx->state[5]; g = ctx->state[6]; h = ctx->state[7]; for (i = 0; i < 64; ++i) { t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i]; t2 = EP0(a) + MAJ(a,b,c); h = g; g = f; f = e; e = d + t1; d = c; c = b; b = a; a = t1 + t2; } ctx->state[0] += a; ctx->state[1] += b; ctx->state[2] += c; ctx->state[3] += d; ctx->state[4] += e; ctx->state[5] += f; ctx->state[6] += g; ctx->state[7] += h; } void sha256_init(SHA256_CTX *ctx) { ctx->datalen = 0; ctx->bitlen = 0; ctx->state[0] = 0x6a09e667; ctx->state[1] = 0xbb67ae85; ctx->state[2] = 0x3c6ef372; ctx->state[3] = 0xa54ff53a; ctx->state[4] = 0x510e527f; ctx->state[5] = 0x9b05688c; ctx->state[6] = 0x1f83d9ab; ctx->state[7] = 0x5be0cd19; } void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len) { for (size_t i = 0; i < len; ++i) { ctx->data[ctx->datalen] = data[i]; ctx->datalen++; if (ctx->datalen == 64) { sha256_transform(ctx, ctx->data); ctx->bitlen += 512; ctx->datalen = 0; } } } void sha256_final(SHA256_CTX *ctx, BYTE hash[]) { WORD32 i = ctx->datalen; if (ctx->datalen < 56) { ctx->data[i++] = 0x80; while (i < 56) ctx->data[i++] = 0x00; } else { ctx->data[i++] = 0x80; while (i < 64) ctx->data[i++] = 0x00; sha256_transform(ctx, ctx->data); memset(ctx->data, 0, 56); } ctx->bitlen += ctx->datalen * 8; ctx->data[63] = ctx->bitlen; ctx->data[62] = ctx->bitlen >> 8; ctx->data[61] = ctx->bitlen >> 16; ctx->data[60] = ctx->bitlen >> 24; ctx->data[59] = ctx->bitlen >> 32; ctx->data[58] = ctx->bitlen >> 40; ctx->data[57] = ctx->bitlen >> 48; ctx->data[56] = ctx->bitlen >> 56; sha256_transform(ctx, ctx->data); for (i = 0; i < 4; ++i) { hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0xff; hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0xff; hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0xff; hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0xff; hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0xff; hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0xff; hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0xff; hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0xff; } } string sha256(const string &str) { BYTE hash[32]; SHA256_CTX ctx; sha256_init(&ctx); sha256_update(&ctx, (const BYTE*)str.c_str(), str.length()); sha256_final(&ctx, hash); char res[65]; for (int i = 0; i < 32; i++) sprintf(res + i * 2, "%02x", hash[i]); return string(res); } struct Item { string name; int effect; int price; }; struct Pet { string name; int attackBonus; bool unlocked; }; struct Quest { string desc; int target; int current; int rewardMat; int rewardCoin; bool completed; }; void slowPrint(const string& text, int ms = 30) { for (char c : text) { cout << c; Sleep(ms); } cout << endl; } void clear() { system("cls"); } int main() { srand((unsigned)time(NULL)); int hp = 130; int maxHp = 130; int attack = 14; int materials = 0; int coins = 5; int equipLevel = 1; int mapLevel = 1; bool shield = false; bool fireUnlocked = false; bool critUnlocked = false; bool haveSecretKey = false; bool godMode = false; Pet pet = {"皮卡虾", 3, false}; string maps[] = {"校园大厅","美食街","虾夷堡垒","最终巢穴","秘密神殿"}; int boss1Hp=220,boss1Atk=19,boss2Hp=310,boss2Atk=25,boss3Hp=420,boss3Atk=31,boss4Hp=580,boss4Atk=38; bool phase2 = false; string mobNames[]= {"小虾米","麻辣虾","香酥虾","虾兵","虾将","激光虾"}; int mobHps[]= {28,42,58,76,92,108}; int mobAtks[]= {5,8,11,14,17,20}; vector<Quest> quests= {{"击败3只怪物",3,0,12,8,false},{"升级装备至2级",2,0,15,10,false},{"击败1号BOSS",1,0,25,18,false},{"解锁宠物",1,0,30,22,false}}; vector<Item> shop= {{"生命药水",45,9},{"攻击强化",9,16},{"护盾",1,13},{"火球术",0,26},{"暴击术",0,32},{"宠物蛋",0,38},{"秘钥",0,55}}; clear(); slowPrint("========================================",30); slowPrint("邪恶香酥虾 - 终极版",35); slowPrint("========================================",30); Sleep(1000); slowPrint("故事:邪恶的虾族入侵了学校!"); Sleep(1200); slowPrint("你是拯救世界的英雄!"); Sleep(1500); while(true) { clear(); slowPrint("========================================"); cout << "当前地图:" << maps[mapLevel-1] << endl; cout << "生命:" << hp << "/" << maxHp << " 攻击:" << attack << " 装备:等级" << equipLevel << endl; cout << "材料:" << materials << " 金币:" << coins << endl; cout << "宠物:" << (pet.unlocked ? pet.name + " (攻击 +"+to_string(pet.attackBonus)+")" : "未解锁") << endl; cout << "秘钥:" << (haveSecretKey ? "已获得" : "未获得") << " 无敌模式:" << (godMode ? "开启" : "关闭") << endl; slowPrint("========================================"); cout << "\n任务:" << endl; for(auto& q:quests) if(!q.completed) cout << "- " << q.desc << " (" << q.current << "/" << q.target << ")" << endl; cout << endl; slowPrint("1.狩猎 2.采集 3.升级 4.治疗 5.商店"); slowPrint("6.地图 7.BOSS 8.宠物 9.秘密 0.退出"); cout << endl; cout << "========================================" << endl; cout << " 输入密码开启作弊" << endl; cout << "========================================" << endl; cout << "\n请选择:"; int choice; cin >> choice; // 输入 999 打开作弊菜单 if(choice == 999) { clear(); cout << "请输入作弊密码:"; string pw; cin >> pw; string h = sha256(pw); if(h == "4c55e9959a2c22155f7d555dca3b97e85abf8f72041eac101f8c2cae4e5e762e") { clear(); slowPrint("========================================",25); slowPrint(" 作弊菜单",25); slowPrint("========================================",25); cout << endl; slowPrint("1.无敌模式 2.材料无限 3.金币无限 4.最强属性 5.全解锁 6.满血 7.返回"); cout << "请选择:"; int hack; cin >> hack; if(hack==1) { godMode=true; slowPrint("无敌模式已开启!"); Sleep(1000); } if(hack==2) { materials+=99999; slowPrint("材料已最大化!"); Sleep(800); } if(hack==3) { coins+=99999; slowPrint("金币已最大化!"); Sleep(800); } if(hack==4) { equipLevel=6; attack=999; maxHp=999; fireUnlocked=true; critUnlocked=true; slowPrint("属性已拉满!"); Sleep(1200); } if(hack==5) { pet.unlocked=true; haveSecretKey=true; slowPrint("全部解锁!"); Sleep(1200); } if(hack==6) { hp=maxHp; shield=true; slowPrint("生命值已满!"); Sleep(800); } } else { slowPrint("密码错误!"); Sleep(1000); } continue; } if(choice==1) { clear(); int idx=rand()%6; string name=mobNames[idx]; int mHp=mobHps[idx]+mapLevel*12; int mAtk=mobAtks[idx]+mapLevel*4; slowPrint("遭遇:"+name); Sleep(600); int pHp=hp; while(true) { int bonus=pet.unlocked?pet.attackBonus:0; int crit=(critUnlocked&&rand()%100<35)?2:1; int dmg=(rand()%5+attack+bonus)*crit; mHp-=dmg; cout << "你造成了 " << dmg << " 点伤害!怪物生命:" << mHp << endl; Sleep(400); if(mHp<=0) { slowPrint("胜利!"); materials+=4+mapLevel; coins+=3+rand()%3; for(auto& q:quests) if(q.desc=="击败3只怪物") q.current++; Sleep(1000); break; } if(!godMode) { if(shield) { slowPrint("护盾抵挡了伤害!"); shield=false; } else { int tDmg=rand()%4+mAtk; pHp-=tDmg; cout << name << "攻击你,造成 " << tDmg << " 点伤害!生命:" << pHp << endl; if(pHp<=0) { slowPrint("你输了!"); return 0; } } } else slowPrint("无敌模式:免疫伤害!"); Sleep(400); } if(!godMode) hp=pHp; } else if(choice==2) { clear(); slowPrint("采集中..."); Sleep(600); materials+=rand()%6+5; cout << "材料:" << materials << endl; Sleep(800); } else if(choice==3) { clear(); if(equipLevel>=6) { slowPrint("已达最高等级!"); Sleep(800); continue; } int need=10+equipLevel*7; if(materials<need) { cout << "需要 " << need << " 个材料!" << endl; Sleep(800); continue; } materials-=need; equipLevel++; attack+=5; maxHp+=12; hp=maxHp; slowPrint("升级成功!"); for(auto& q:quests) if(q.desc=="升级装备至2级"&&equipLevel>=2) q.current=2; Sleep(800); } else if(choice==4) { clear(); if(materials<5) { slowPrint("需要5个材料!"); Sleep(800); continue; } materials-=5; hp=min(maxHp,hp+40); cout << "治疗完成!生命:" << hp << endl; Sleep(800); } else if(choice==5) { clear(); slowPrint("===== 商店 ====="); for(int i=0; i<shop.size(); i++) cout << i+1 << ". " << shop[i].name << " 价格:" << shop[i].price << " 金币" << endl; cout << "金币:" << coins << "\n购买(0返回):"; int c; cin>>c; if(c==0) continue; c--; if(coins<shop[c].price) { slowPrint("金币不足!"); Sleep(800); continue; } coins-=shop[c].price; if(c==0) hp=min(maxHp,hp+shop[c].effect); if(c==1) attack+=shop[c].effect; if(c==2) shield=true; if(c==3) fireUnlocked=true; if(c==4) critUnlocked=true; if(c==5) { pet.unlocked=true; quests[3].current=1; } if(c==6) haveSecretKey=true; slowPrint("购买成功!"); Sleep(800); } else if(choice==6) { clear(); if(mapLevel>=4) { slowPrint("已到达最终地图!"); Sleep(800); continue; } mapLevel++; slowPrint("进入:"+maps[mapLevel-1]); Sleep(1000); } else if(choice==7) { clear(); string bn; int bh,ba; if(mapLevel==1) { bn="麻辣虾首领"; bh=boss1Hp; ba=boss1Atk; } else if(mapLevel==2) { bn="香酥虾将军"; bh=boss2Hp; ba=boss2Atk; } else if(mapLevel==3) { bn="虾夷守护者"; bh=boss3Hp; ba=boss3Atk; } else { bn="邪恶香酥虾"; bh=boss4Hp; ba=boss4Atk; } slowPrint("BOSS战:"+bn); Sleep(1000); int pHp=hp; while(true) { int dmg=rand()%6+attack+(pet.unlocked?pet.attackBonus:0); if(fireUnlocked) dmg+=rand()%12+18; if(critUnlocked&&rand()%100<35) dmg*=2; bh-=dmg; cout << "你对BOSS造成 " << dmg << " 点伤害!生命:" << bh << endl; Sleep(500); if(mapLevel==4&&bh<=0&&!phase2) { slowPrint("BOSS进入狂暴状态!第二阶段!"); phase2=true; bh=320; ba+=12; Sleep(1500); continue; } if(bh<=0) { slowPrint("BOSS被击败!"); materials+=40+mapLevel*15; coins+=30+mapLevel*12; if(mapLevel==1) quests[2].current=1; if(mapLevel==4) { slowPrint("你赢了!"); Sleep(2000); return 0; } Sleep(1500); break; } if(!godMode) { if(shield) { slowPrint("护盾抵挡了攻击!"); shield=false; } else { int td=rand()%7+ba; pHp-=td; cout << "BOSS攻击你,造成 " << td << " 点伤害!生命:" << pHp << endl; if(pHp<=0) { slowPrint("你输了!"); return 0; } } } else slowPrint("无敌模式生效!"); Sleep(500); } if(!godMode) hp=pHp; } else if(choice==8) { clear(); if(!pet.unlocked) { slowPrint("宠物未解锁!"); Sleep(1200); continue; } slowPrint("宠物:"+pet.name); cout << "攻击 +" << pet.attackBonus << endl; Sleep(1000); } else if(choice==9&&haveSecretKey) { clear(); slowPrint("秘密关卡:黄金虾神"); Sleep(1000); int gh=420,ph=hp; while(true) { int dmg=rand()%10+attack+(pet.unlocked?pet.attackBonus:0); if(critUnlocked&&rand()%100<50) dmg*=2; gh-=dmg; cout << "造成 " << dmg << " 点伤害!虾神生命:" << gh << endl; Sleep(400); if(gh<=0) { slowPrint("秘密关卡通关!获得奖励!"); materials+=80; coins+=70; attack+=15; maxHp+=30; haveSecretKey=false; Sleep(1800); break; } if(!godMode) { int td=rand()%8+24; ph-=td; if(ph<=0) { slowPrint("挑战失败!"); return 0; } } Sleep(400); } if(!godMode) hp=ph; } for(auto& q:quests) if(q.current>=q.target&&!q.completed) { q.completed=true; materials+=q.rewardMat; coins+=q.rewardCoin; slowPrint("任务完成!"); Sleep(1000); } else if(choice==0) { clear(); slowPrint("感谢游玩!"); Sleep(1500); break; } } return 0; } -
@ 2026-4-4 11:48:18@xbr9276(小柏然),你写好开头了吗(快更新)?1.1.1~1.3.19汝来更新,剩余的me来更新...
- 1
信息
- ID
- 940
- 时间
- ms
- 内存
- MiB
- 难度
- 8
- 标签
- 递交数
- 135
- 已通过
- 25
- 上传者