AC 热力图
较少
较多
徽章?
共 17 枚-
个人简介
贤者之屋
坚持日拱一卒,每天进步一点点 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 200005; struct Tree { int l, r, maxv; } tr[N * 4]; int m, p; int n = 0; int last_ans = 0; void build(int u, int l, int r) { tr[u].l = l; tr[u].r = r; tr[u].maxv = 0; if (l == r) return; int mid = (l + r) >> 1; build(u << 1, l, mid); build(u << 1 | 1, mid + 1, r); } void update(int u, int pos, int val) { if (tr[u].l == tr[u].r) { tr[u].maxv = val; return; } int mid = (tr[u].l + tr[u].r) >> 1; if (pos <= mid) update(u << 1, pos, val); else update(u << 1 | 1, pos, val); tr[u].maxv = max(tr[u << 1].maxv, tr[u << 1 | 1].maxv); } int query(int u, int l, int r) { if (l <= tr[u].l && tr[u].r <= r) { return tr[u].maxv; } int mid = (tr[u].l + tr[u].r) >> 1; int res = 0; if (l <= mid) res = max(res, query(u << 1, l, r)); if (r > mid) res = max(res, query(u << 1 | 1, l, r)); return res; } signed main() { cin >> m >> p; build(1, 1, m); for (int i = 1; i <= m; i++) { char op; cin >> op; if (op == 'A') { int t; cin >> t; int val = (t + last_ans) % p; n++; update(1, n, val); } else { int L; cin >> L; last_ans = query(1, n - L + 1, n); cout << last_ans << '\n'; } } }骗分过样例,暴力出奇迹。 数学先打表,DP看运气。 穷举TLE,递推UKE。 模拟MLE,贪心还CE。 想要骗到分,就要有方法。 图论背模板,数论背公式。 动规背方程,高精背代码。 如果都没背,干脆输样例。 模拟只会猜题意,贪心只能过样例; 数学上来先打表,DP一般看规律. 递归递推伤不起,搜索茫然TLE; 分治做得像枚举,暴力枚举数第一.你看待痛苦的方式,就是你对待人生的方式数学是火,点亮物理的灯; 物理是灯,照亮化学的路; 化学是路,通向生物的坑; 生物是坑,埋葬学理的人。 文言是火,点亮历史宫灯; 历史是灯,照亮社会之路; 社会是路,通向哲学大坑; 哲学是坑,埋葬文科生。关于学好OI的一些参考书籍: 第一阶段: 《信息学奥赛一本通》 《信息学分析讲义》 第二阶段: 《彷徨》 第三阶段: 《教你怎么不生气》 《佛经》 《老子》《沉默的愤怒》 第四阶段: 《颈椎病康复指南》 《腰椎间盘突出日常护理》 《心脏病的预防与防治》 《高血压降压宝典》 《强迫症的自我恢复》 《精神病症状学》 第五阶段: 《活着》 第六阶段: 《冥府指南》悲观者永远正确,乐观者永远向前算法可能会欺骗你,可暴力不会你永远想不到,出卖你的,往往是你的朋友——为了荣誉,不惜牺牲一切,强者总是没人支持,但是俗话说,犹豫就会败北,果断等于白给,所以现在,去追逐我们自己的梦想,活着,为了地位而努力吧这一天,人们想起了曾经被巨人支配的恐惧觉醒吧!坐在羽绒垫子上、躺在毯子下面,如何扬名于天下?没有努力,人生就是虚度,在人间的丰功伟绩就如水中的泡沫或者风中的烟雾贤者游戏
#include <bits/stdc++.h> #include <stdio.h> #include <conio.h> #include <chrono> #include <thread> #include <windows.h> #include <cstdlib> using namespace std; string jqx[100]; struct p { int h; int g; int f; double dj; string jn; bool j; string name; string ne; long long jb=0; }; struct gw { int h; int g; int f; string name; }; struct fbn { string nm; bool js=false; }; p player; p sz; fbn fb[8]; bool ps=false; bool bfb=true; void jixujian() { this_thread::sleep_for(chrono::duration<double>(1.5)); cout<<endl; cout<<"按a以继续----------"; while (_getch()!='a') {} } void jq() { for (int i=1; i<=16; i++) { system("cls"); cout<<"剧情"<<endl<<endl; cout<<" "<<jqx[i]; if (i==16) { break; } cout<<endl; jixujian(); } for (int i=1; i<=5; i++) { this_thread::sleep_for(chrono::duration<double>(1)); cout<<'.'; } this_thread::sleep_for(chrono::duration<double>(1.5)); system("cls"); this_thread::sleep_for(chrono::duration<double>(1.5)); } void bt() { cout<<" "; this_thread::sleep_for(chrono::duration<double>(0.3)); for (int i=1; i<=4; i++) { if (i==1) { cout<<"冒 "; } else if(i==2) { cout<<"险 "; } else if(i==3) { cout<<"乱 "; } else { cout<<"斗"; } this_thread::sleep_for(chrono::duration<double>(0.3)); } cout<<endl; this_thread::sleep_for(chrono::duration<double>(0.5)); string v="The Adventure Brawl"; for (int i=0; i<v.size(); i++) { cout<<v[i]; this_thread::sleep_for(chrono::duration<double>(0.2)); } cout<<endl; jixujian(); system("cls"); this_thread::sleep_for(chrono::duration<double>(2)); } void fba(int n) { this_thread::sleep_for(chrono::duration<double>(1.5)); if (n==1) { cout<<"主线任务---击败所有小兵:野生刘姥姥";//75 50 200 this_thread::sleep_for(chrono::duration<double>(2)); system("cls"); } if (n==2) { cout<<"主线任务---击败所有将领:痔疮战士·肛铁侠";//100 88 350 this_thread::sleep_for(chrono::duration<double>(2)); system("cls"); } if (n==3) { cout<<"主线任务---击败泥坑天王小猪猎奇";//150 100 370 this_thread::sleep_for(chrono::duration<double>(2)); system("cls"); } if (n==4) { cout<<"主线任务---击败眼泪天王烤乳猪乔治";//150 150 500 this_thread::sleep_for(chrono::duration<double>(2)); system("cls"); } if (n==5) { cout<<"主线任务---击败开朗天王翠花妈妈"; this_thread::sleep_for(chrono::duration<double>(2));//200 200 650 system("cls"); } if (n==6) { cout<<"主线任务---击败权威天王肘击爸爸"; this_thread::sleep_for(chrono::duration<double>(2));//230 210 800 system("cls"); } if (n==7) { cout<<"主线任务---击败头目吉吉国王";//333 333 850,666 666 1111 this_thread::sleep_for(chrono::duration<double>(2)); system("cls"); } srand(time(0)); cout<<"提示-----"<<endl; if (rand()%4==0) { cout<<"系统会实时汇报每一只怪物的血量..."; } else if(rand()%4==1) { cout<<"怪物被打败时名字会消失..."; } else if (rand()%4==2) { cout<<"没血时会自动退出..."; } else { cout<<"等级越高,解锁的地图越多..."; } this_thread::sleep_for(chrono::duration<double>(3.5)); system("cls"); } void tcfb() { system("cls"); this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<"退出副本中"; for (int i=1; i<=7; i++) { this_thread::sleep_for(chrono::duration<double>(1)); cout<<'.'; } system("cls"); this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<"退出成功"; this_thread::sleep_for(chrono::duration<double>(1)); system("cls"); } void cszc() { cout<<"您好尊敬的"<<player.name<<"玩家,正在把您传送至主城"; for (int i=1; i<=5; i++) { this_thread::sleep_for(chrono::duration<double>(1)); cout<<'-'; } this_thread::sleep_for(chrono::duration<double>(1)); cout<<"传送成功"; this_thread::sleep_for(chrono::duration<double>(1)); system("cls"); } bool csjm() { this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<endl<<" ----冒险乱斗----"<<endl; this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<" | [开始游戏] |"<<endl; cout<<" | (勇士--正传篇) |"<<endl; this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<endl<<" ------------------输入任意键开始"; char n=_getch(); system("cls"); this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<endl<<" 加载中"; for (int i=1; i<=12; i++) { this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<'.'; } this_thread::sleep_for(chrono::duration<double>(0.5)); system("cls"); cout<<endl<<" 等待中"; for (int i=1; i<=5; i++) { this_thread::sleep_for(chrono::duration<double>(2)); cout<<'-'; } this_thread::sleep_for(chrono::duration<double>(0.5)); system("cls"); cout<<endl<<" 加载成功---"; this_thread::sleep_for(chrono::duration<double>(1)); system("cls"); } void xzzy() { cout<<"-------------------"<<endl; this_thread::sleep_for(chrono::duration<double>(0.5)); string s[3]; cout<<"请选择职业---"<<endl<<endl; this_thread::sleep_for(chrono::duration<double>(1)); s[0]="1.战士\n攻击75 防御55 血量250\n技能:视死如归\n(血量低于50,攻击增加30\n"; s[1]="2.刺客\n攻击80 防御50 血量180\n技能:自尽\n(血量减50,攻击加10\n"; s[2]="3.法师\n攻击70 防御52 血量280\n技能:起死回生\n(血量低于30,血量变成150\n"; cout<<s[0]<<endl<<s[1]<<endl<<s[2]<<endl; cout<<"输入职业序号(1-3):"; string zy; cin>>zy; while (zy!="1" && zy!="2" && zy!="3" && zy!="666" && zy!="杀!!!") { cout<<"输入错误,请重新输入:"; cin>>zy; } system("cls"); if (zy=="1") { cout<<"您的职业:战士"; player.jn="视死如归"; player.f=55; player.g=75; player.h=250; player.j=true; player.dj=0; player.ne="战士"; } if (zy=="2") { cout<<"您的职业:刺客"; player.jn="自尽"; player.f=50; player.g=80; player.h=180; player.j=true; player.dj=0; player.ne="刺客"; } if (zy=="3") { cout<<"您的职业:法师"; player.jn="起死回生"; player.f=52; player.g=70; player.h=280; player.j=true; player.dj=0; player.ne="法师"; } if (zy=="666") { cout<<"恭喜您获得隐藏职业:幸运天使"; player.f=90; player.g=60; player.h=300; player.dj=0; player.ne="幸运天使"; } if (zy=="杀!!!") { cout<<"恭喜您获得隐藏职业:恶魔"; player.f=999; player.g=999; player.h=9999; player.dj=99; player.ne="恶魔"; } sz=player; this_thread::sleep_for(chrono::duration<double>(3)); system("cls"); this_thread::sleep_for(chrono::duration<double>(1)); cout<<"请输入您的名称:"; cin>>player.name; this_thread::sleep_for(chrono::duration<double>(1)); } void battle(gw monster) { system("cls"); cout<<"战斗开始!"<<endl; this_thread::sleep_for(chrono::duration<double>(1)); int round = 1; while(player.h > 0 && monster.h > 0) { system("cls"); cout<<"第"<<round<<"回合"<<endl; cout<<"-------------------"<<endl; cout<<player.name<<"(HP:"<<player.h<<") vs "<<monster.name<<"(HP:"<<monster.h<<")"<<endl; cout<<"-------------------"<<endl; cout<<"1.攻击"<<endl; cout<<"2.防御"<<endl; if(player.j) { cout<<"3.使用技能("<<player.jn<<")"<<endl; } char choice = _getch(); while(choice != '1' && choice != '2' && (choice != '3' || !player.j)) { choice = _getch(); } int player_damage = 0; int monster_damage = 0; if(choice == '1') { player_damage = max(1, player.g - monster.f/2); monster.h -= player_damage; cout<<player.name<<"对"<<monster.name<<"造成了"<<player_damage<<"点伤害!"<<endl; } else if(choice == '2') { cout<<player.name<<"采取了防御姿态!"<<endl; player.f += 10; } else if(choice == '3') { if(player.jn == "视死如归") { if(player.h <= 50) { player.g += 30; cout<<player.name<<"发动技能"<<player.jn<<",攻击力增加30!"<<endl; } else { cout<<"血量高于50,无法发动技能!"<<endl; } } else if(player.jn == "自尽") { player.h -= 50; player.g += 10; cout<<player.name<<"发动技能"<<player.jn<<",血量减少50,攻击力增加10!"<<endl; } else if(player.jn == "起死回生") { if(player.h <= 30) { player.h = 150; cout<<player.name<<"发动技能"<<player.jn<<",血量恢复到150!"<<endl; } else { cout<<"血量高于30,无法发动技能!"<<endl; } } } this_thread::sleep_for(chrono::duration<double>(1)); if(monster.h>0) { monster_damage = max(1,monster.g - player.f/2); player.h-=monster_damage; cout<<monster.name<<"对"<<player.name<<"造成了"<<monster_damage<<"点伤害!"<<endl; } if(choice=='2') { player.f-=10; } this_thread::sleep_for(chrono::duration<double>(1.5)); round++; } system("cls"); if(player.h>0) { if (monster.name=="头目吉吉国王"){ ps=true; } cout<<"胜利!"<<monster.name<<"被击败了!"<<endl; player.jb+=rand()%51; player.dj+=1; cout<<"获得"<<rand()%51<<"卢比!"<<endl; cout<<"经验值增加!"<<endl; } else { cout<<"失败!"<<player.name<<"被击败了!"<<endl; player.h=max(1,sz.h/3); } player=sz; this_thread::sleep_for(chrono::duration<double>(2)); } void jzfb(int n) { system("cls"); this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<"正在进入副本中"; for (int i=1; i<=7; i++) { this_thread::sleep_for(chrono::duration<double>(1)); cout<<'.'; } this_thread::sleep_for(chrono::duration<double>(1)); system("cls"); cout<<"加载成功!"; this_thread::sleep_for(chrono::duration<double>(1)); system("cls"); fba(n); gw monster; if (n==1) { monster.name="野生刘姥姥"; monster.h=200; monster.g=75; monster.f=50; } if (n==2) { monster.name="痔疮战士·肛铁侠"; monster.h=350; monster.g = 100; monster.f = 88; } if (n==3) { monster.name="泥坑天王小猪猎奇"; monster.h=370; monster.g=150; monster.f=100; } if (n==4) { monster.name="眼泪天王烤乳猪乔治"; monster.h=500; monster.g=150; monster.f=150; } if (n==5) { monster.name="开朗天王翠花妈妈"; monster.h=650; monster.g=200; monster.f=200; } if (n==6) { monster.name="权威天王肘击爸爸"; monster.h=800; monster.g=230; monster.f=210; } if (n==7) { monster.name="头目吉吉国王"; monster.h=1111; monster.g=666; monster.f=666; } battle(monster); if (fb[7].js && ps){ system("cls"); MessageBoxA(NULL,"游戏已通关!", "完结提示", MB_OK); } if (player.dj>=9){ fb[2].js=true; } if (player.dj>=19){ fb[3].js=true; } if (player.dj>=29){ fb[4].js=true; } if (player.dj>=39){ fb[5].js=true; } if (player.dj>=49){ fb[6].js=true; } if (player.dj>=59){ fb[7].js=true; } tcfb(); } void fbdg() { while (true) { for (int i=1; i<8; i++) { this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<i<<'.'<<fb[i].nm; if (fb[i].js) { cout<<"(已解锁)"<<endl; } else { cout<<"(未解锁)"<<endl; } } this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<"请输入您要进入的副本序号(0为退出)"<<endl; char c=_getch(); while (((c!='1' && c!='2' && c!='3' && c!='4' && c!='5' && c!='6' && c!='7') || fb[c-'0'].js==false) && c!='0') { if(c!='1' && c!='2' && c!='3' && c!='4' && c!='5' && c!='6' && c!='7') { cout<<"输入错误"<<endl; } else { cout<<"副本未解锁"<<endl; } c=_getch(); } if (c=='0') { system("cls"); cout<<"正在退出中"; for (int i=1; i<=6; i++) { this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<'.'; } this_thread::sleep_for(chrono::duration<double>(0.5)); system("cls"); cout<<"退出成功"; this_thread::sleep_for(chrono::duration<double>(1)); return; } jzfb(c-'0'); } } void sc() { this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<"这里是商城,您可以随心所欲地买东西—"<<endl; this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<"1.一滴血(150卢比)"<<endl; this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<"2.一个防御值(150卢比)"<<endl; this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<"3.金箍棒碎片(加10攻击,2000卢比)"<<endl; this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<"请输入你要买的东西的序号(0为退出)"<<endl; string c; bool flag=true; bool bbb=true; while (true) { if (player.jb>99999999999999999) { player.jb=99999999999999999; } if (flag) { flag=false; cout<<"您的钱数:"<<player.jb<<"卢比"<<endl; } cin>>c; if (c!="0" && c!="1" && c!="2" && c!="3" && c!="恶魔") { while (c!="0" && c!="1" && c!="2" && c!="3" && c!="恶魔") { cout<<"输入错误,请重新输入"<<endl; cin>>c; } } if (c=="0") { system("cls"); cout<<"退出中"; for (int i=1; i<=7; i++) { this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<'.'; } this_thread::sleep_for(chrono::duration<double>(0.5)); cout<<"退出成功"; this_thread::sleep_for(chrono::duration<double>(1)); return; } if (c=="恶魔" && bbb) { bbb=false; cout<<"您已解锁隐藏成就,杀戮之剑,获得大量卢比"<<endl; player.jb=99999999999999999; } else if (!bbb && c=="恶魔") { cout<<"此成就兑换已经无效"<<endl; continue; } if (c=="1") { if (player.jb>=150) { player.jb-=150; player.h++; cout<<"购买成功"<<endl; } else { cout<<"卢比不足,无法购买"<<endl; } } else if (c=="2") { if (player.jb>=150) { player.jb-=150; player.f++; cout<<"购买成功"<<endl; } else { cout<<"卢比不足,无法购买"<<endl; } } else if (c=="3") { if (player.jb>2000) { player.jb-=2000; player.g+=10; cout<<"购买成功"<<endl; } else { cout<<"卢比不足,无法购买"<<endl; } } sz=player; cout<<"您的剩余卢比:"<<player.jb<<endl; } } void grzy() { this_thread::sleep_for(chrono::duration<double>(1)); cout<<"个人信息:"<<endl; this_thread::sleep_for(chrono::duration<double>(1)); cout<<"游戏名称 "<<player.name<<endl; this_thread::sleep_for(chrono::duration<double>(1)); cout<<"角色名称 "<<player.ne<<endl; this_thread::sleep_for(chrono::duration<double>(1)); cout<<"攻击 "<<player.g<<','<<"防御 "<<player.f<<','<<"血量 "<<player.h<<endl; this_thread::sleep_for(chrono::duration<double>(1)); cout<<"技能 "; if (player.jn=="") { cout<<"无"<<endl; } else { cout<<player.jn; } this_thread::sleep_for(chrono::duration<double>(1)); cout<<endl; cout<<"等级 "<<player.dj*1<<endl; this_thread::sleep_for(chrono::duration<double>(1)); cout<<"卢比 "<<player.jb<<endl; jixujian(); } void zc() { while (true) { system("cls"); this_thread::sleep_for(chrono::duration<double>(0.5)); cszc(); cout<<"尊敬的"<<player.name<<"玩家,请您选择要做的事情"<<endl<<"1是打怪"<<endl<<"2是商城"<<endl<<"3是角色信息"<<endl<<"4是暂停游戏"<<endl; char c=_getch(); while (c!='1' && c!='2' && c!='3' && c!='4') { cout<<"输入错误,请重新输入"<<endl; c=_getch(); } system("cls"); if (c=='1') { fbdg(); } else if (c=='2') { sc(); } else if(c=='3') { grzy(); } else { bt(); } } } void main2() { system("color a"); fb[1].nm="初始空岛"; fb[1].js=true; fb[2].nm="初始台地"; fb[3].nm="水之神殿"; fb[4].nm="火之神殿"; fb[5].nm="风之神殿"; fb[6].nm="雷之神殿"; fb[7].nm="海拉鲁城堡"; jqx[1]="在遥远的过去,你在一\n个幸福的国度,人们也\n安居乐业..."; jqx[2]="但有一天,吉吉召\n集了国家内的所有人,\n并宣布了件事情..."; jqx[3]="“从现在开始,吸气要扣税!!!\n我把公主囚禁了,现在我是王!!!”"; jqx[4]="大家不得不服从,但有\n些人去刺杀吉吉国王..."; jqx[5]="但是无一都失败了..."; jqx[6]="因为吉吉国王安排了四大天王镇守四方,分别是..."; jqx[7]="泥坑天王,小猪猎奇!"; jqx[8]="眼泪天王,小猪猎奇弟弟,烤乳猪乔治!"; jqx[9]="开朗天王,小猪猎奇妈妈,翠花!"; jqx[10]="权威天王,小猪猎奇的肘击爸爸!"; jqx[11]="但是一个人,他嘲讽了起来..."; jqx[12]="他讨伐吉吉国王的事,\n你们一定都听说过..."; jqx[13]="有人说,他在那场战斗\n中获得了无尚力量---"; jqx[14]="有人说,他在讨伐吉吉国王\n的路上战死了---"; jqx[15]="还有人说,他只不过是\n人们编造出的无名小卒..."; jqx[16]="但接下来我要说的故事———你们一定没有听过"; csjm(); if (bfb) { cout<<"触发剧情!!!"<<endl; this_thread::sleep_for(chrono::duration<double>(1.5)); system("cls"); this_thread::sleep_for(chrono::duration<double>(1)); jq(); bfb=false; } bt(); xzzy(); zc(); } int main() { main2(); return 0; } -
最近活动
- 2026 CSP复赛重现赛 (官方数据) IOI
- L5-260530-第二阶段测试-可答疑 IOI
- L5-60530-第一阶段测试-可答疑 IOI
- Atcoder比赛文字题解 作业
- 颜老师 - L4小班50907 - 晋级测试 - 不答疑 IOI
- 颜老师 - L4小班50907 - 第四次阶段测试 - 订正 IOI
- 颜老师 - L4小班50907 - 第四次阶段测试 - 可答疑 IOI
- 可达等级赛 - 白银组(二级) - 不答疑 IOI
- 可达等级赛 - 青铜组(一级) - 不答疑 IOI
- 颜老师 - L4小班50907 - 第三次阶段测试 - 订正 IOI
- 颜老师 - L4小班50907 - 第三次阶段测试 - 可答疑 IOI
- 『可达双周赛 』#27 - Div.1 IOI
- L4小班50907兰老师班 - 阶段测试1 - 订正 IOI
- L4小班50907兰老师班 - 阶段测试1 - 可答疑 IOI
- 【自测】 CSP-J 2025(官方数据) OI
- 「AIPI OI」Round3 & Summer Holidays Contest1 IOI
- 25暑假集训 - 欧拉班 - 测试 IOI
- BJ普及2班Day03 订正 IOI
- BJ普及2班Day03 IOI
- BJ普及2班Day02 订正 IOI
- BJ普及2班Day02 IOI
- BJ普及2班Day01 订正 IOI
- BJ普及2班Day01 IOI
- 2025可达班 第二轮选拔赛 IOI
- L3晋级测试250208 (订正) IOI
- L3晋级测试250208 IOI
- L3晋级测试250125-订正 IOI
- 春节欢乐赛 IOI
- l3晋级测试1-40714 IOI
- l3阶段测试40714 IOI
- L2阶段测试1(40818)-袁老师班-订正 IOI
- L2字符串阶段测试 - 周五兰老师班 IOI
- L3-阶段测试40713-2-订正 IOI
- 【可达出题组 · 学生公开赛】 Round2 IOI