• 个人简介

    2024/6/24 荣登榜一

    未来是科技的时代,那我要成为一名能够推动科技进步的人.


    蒟蒻一枚~

    UNDERTALE 忠实玩家

    本蒟洛谷


    这里是我觉得可以一试的题,没抄题解过或看思路过就证明你已经熟练掌握了以下知识点~~

    1. P3046 海港:队列,按序删除,桶思想
    2. P3 a*b%p:快速幂,位运算
    3. P7 递归实现排列型枚举:递归
    4. P13 最高的牛:前缀和&差分
    5. P751 推销员:贪心
    6. P1202 求10000以内n的阶乘:高精度
    7. P2956 旋旋旋旋旋旋旋:die模拟

    万能头:那我走

    #include <algorithm>
    #include <bitset>
    #include <cctype>
    #include <cerrno>
    #include <clocale>
    #include <cmath>
    #include <complex>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <ctime>
    #include <deque>
    #include <exception>
    #include <fstream>
    #include <functional>#include <limits>
    #include <list>
    #include <map>
    #include <iomanip>
    #include <ios>
    #include <iosfwd>
    #include <iostream>
    #include <istream>
    #include <ostream>
    #include <queue>
    #include <set>
    #include <sstream>
    #include <stack>
    #include <stdexcept>
    #include <streambuf>
    #include <string>
    #include <utility>
    #include <vector>
    #include <cwchar>
    #include <cwctype>
    #include <complex.h>
    #include <fenv.h>
    #include <inttypes.h>
    #include <stdbool.h>
    #include <stdint.h>
    #include <tgmath.h>
    #include <windows.h>
    

    ©著作权归作者所有: https://blog.51cto.com/hugengyong/2702061


    一直有个想法,咱 OI 不是很多很多的知识点吗?那么如果把他们做成拟人/同人。。。

    可是 从来没有巨佬跟我说过这个想法从来没有巨佬跟我说过这个想法

    OI真的是很奇妙的世界哇!!!


    附:UT自创小游戏,转载请注明 出处及作者谢谢:

    #include<bits/stdc++.h>
    #include <conio.h>
    #include <windows.h>
    using namespace std;
    const int N=1e2+10;
    const int INF=0x3f3f3f3f;
    
    bool YOU_DIED=0,YOU_WON=0;
    int EXP_TO_LOVE[25]={0,20,25,30,40,50,60,70,80,94,115,120,130,150,167,189,190,200,200,230,1000000};
    struct Ploblems{
    	string pr;
    	int ans,spd;
    }p[N];
    struct Things{
    	string name;
    	int help_atk,help_def,help_hp;
    	int Much_Buy,G,Kind_Of;//1武器2防具3药 
    }tg[N];
    struct Monsters{
    	int Max_HP,ATK,HP,DEF,Mercy_Time,Shot;
    	string name,Speak;
    }m[N];
    struct Frisk{
    	int Max_HP,ATK,HP,DEF;
    	int LV,EXP,G,Stage;
    	int Drug_Bag[N],ATK_Bag[N],DEF_Bag[N];
    	int Have_Drug,Have_ATK,Have_DEF;
    	int knife,shield;
    	string name;
    }y;
    
    void slowsay(string a,int speed=39)
    {
    	int alen=a.size();
    	for(int i=0;i<alen;i++){
    		Sleep(speed);
    		cout<<a[i];
    	}
    }
    
    void Shop_Draw(int l)
    {
    	printf("-----------------------------------\n");
    	l==1?printf(">>提米薄片      40G\n"):printf("  提米薄片      40G\n");
    	l==2?printf(">>传说英雄      280G\n"):printf("  传说英雄      280G\n");
    	l==3?printf(">>蜘蛛蛋糕      400G\n"):printf("  蜘蛛蛋糕      400G\n");
    	l==4?printf(">>平底锅        500G\n"):printf("  平底锅        500G\n");
    	l==5?printf(">>提米盔甲!!  1700G\n"):printf("  提米盔甲!!  1700G\n");
    	l==6?printf(">>甜甜圈套餐    9999G\n"):printf("  甜甜圈套餐    9999G\n");
    	l==7?printf(">>退出商店\n"):printf("  退出商店\n"); 
    	printf("-----------------------------------\n");
    	if(l==1)printf("*防具  防御+20\n*不用担心防御,轻轻松松地战斗\n");  
    	if(l==2)printf("*药品  HP+40\n*很好吃的三明治\n");  
    	if(l==3)printf("*药品  HP+60\n*有奇效的蛋糕\n");  
    	if(l==4)printf("*防具  防御+30,攻击+10\n*神器\n");  
    	if(l==5)printf("*防具  防御+?\n*你等着瞧叭,看看它多厉害!\n");  
    	if(l==6)printf("*??  \n*奸商!!!\n"); 
    	if(l==7)printf("*按'k'键退出\n"); 
    	printf("-----------------------------------\n");
    }
    void Buy_Things_From_Shop()
    {
    	system("cls");
    	slowsay("*你吼,我素提米!欢迎来到TEMMY SHOP!!\n");
    	Sleep(200);
    	BUY_AGAIN:
    	system("cls");
    	printf("*你吼,我素提米!欢迎来到TEMMY SHOP!!\n");
    	int HREAT_LINE=1;
    	Shop_Draw(HREAT_LINE);
    	while(1)
    	{
    		Sleep(10);
    		if(kbhit())
    		{
    		    char x=_getch();
    		    if(x=='k' && HREAT_LINE==7)
    		    {
    		    	system("cls");
    				slowsay("欢银下次光临!"); 
    				return;
    			}
    			else if(x=='w')
    			{
    				system("cls");
    				printf("*你吼,我素提米!欢迎来到TEMMY SHOP!!\n");
    				Shop_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
    			}
    			else if(x=='s')
    			{
    				system("cls");
    				printf("*你吼,我素提米!欢迎来到TEMMY SHOP!!\n");
    				Shop_Draw(HREAT_LINE==7?7:++HREAT_LINE); 
    			}
    			else if(x=='k')
    			{
    				system("cls");
    				if(y.G>=tg[HREAT_LINE].G && tg[HREAT_LINE].Much_Buy>=1)
    				{
    					slowsay("*购买成功!\n");
    					if(HREAT_LINE==6)
    					{
    						Sleep(1000);
    						slowsay("*提米偷偷嗦:介个家伙素不素有钱没地方花..."); 
    					}
    					y.G-=tg[HREAT_LINE].G;
    					tg[HREAT_LINE].Much_Buy-=1;
    					if(tg[HREAT_LINE].Kind_Of==1)
    					{
    						y.ATK_Bag[++y.Have_ATK]=HREAT_LINE;
    					}
    					if(tg[HREAT_LINE].Kind_Of==2)
    					{
    						y.DEF_Bag[++y.Have_DEF]=HREAT_LINE;
    					}
    					if(tg[HREAT_LINE].Kind_Of==3)
    					{
    						y.Drug_Bag[++y.Have_Drug]=HREAT_LINE;
    					}
    				}
    				else if(y.G<tg[HREAT_LINE].G)
    				{
    					slowsay("*你好像没有足够哒钱钱\n");
    				}
    				else if(tg[HREAT_LINE].Much_Buy<1)
    				{
    					slowsay("*啊哦,今天售罄了...\n");
    				}
    				Sleep(500);
    				goto BUY_AGAIN;
    			}
    		}
    	}
    	return;
    }
    void Main_Draw(int l)
    {
    	printf("-----------------------------------\n");
    	l==1?printf(">>商店\n"):printf("  商店\n");
    	l==2?printf(">>存档\n"):printf("  存档\n"); 
    	l==3?printf(">>查看\n"):printf("  查看\n"); 
    	l==4?printf(">>战斗\n"):printf("  战斗\n"); 
    	l==5?printf(">>退出\n"):printf("  退出\n");
    	printf("-----------------------------------\n");
    	printf("操作方式:w上 s下 k确认\n");
    	printf("-----------------------------------");
    	return; 
    }
    void File()
    {
    	system("cls"); 
    	int c=y.G;
    	int atk=y.ATK;
    	int def=y.DEF;
    	int mh=y.Max_HP;
    	int hp=y.HP;
    	int exp=y.EXP;
    	int lv=y.LV;
    	int hd=y.Have_Drug,ha=y.Have_ATK,hde=y.Have_DEF;
    	
    	FILE*fp=fopen("./undertale_cundang.txt","w");
    	fprintf(fp,"%d %d %d %d %d %d %d %d %d %d %d ",c,atk,def,mh,hp,exp,lv,hd,ha,hde,y.Stage);
    	for(int i=1;i<=y.Have_Drug;++i)
    	{
    		fprintf(fp,"%d ",y.Drug_Bag[i]);
    	}
    	for(int i=1;i<=y.Have_ATK;++i)
    	{
    		fprintf(fp,"%d ",y.ATK_Bag[i]);
    	}
    	for(int i=1;i<=y.Have_DEF;++i)
    	{
    		fprintf(fp,"%d ",y.DEF_Bag[i]);
    	}
    	fclose(fp);
    	
    	for(int i=1;i<10;i++)
    	{
    		system("cls");
    		if(i%3==0)cout<<"正在存档中...";
    		if(i%3==1)cout<<"正在存档中.";
    		if(i%3==2)cout<<"正在存档中..";
    		Sleep(300);
    	}
    	system("cls");
    	cout<<"存档成功!";
    	Sleep(2000);
    	system("cls");
    	return;
    }
    void Frisk_Define()
    {
    	y.ATK=18;
    	y.DEF=0;
    	y.EXP=0;
    	y.G=10000;
    	y.Have_Drug=0;
    	y.HP=20;
    	y.LV=1;
    	y.Max_HP=20;
    	y.name="Frisk";
    	y.Stage=1;
    }
    void Monster_Define()
    {
    	m[1].ATK=19,m[1].DEF=0,m[1].HP=25,m[1].Max_HP=25,m[1].name=" 小花 ";m[1].Speak="*杀或被杀\n"; 
    	m[2].ATK=6,m[2].DEF=8,m[2].HP=20,m[2].Max_HP=20,m[2].name=" 蛙吉特 ";m[2].Speak="*第一个对手\n";
    	m[3].ATK=10,m[3].DEF=3,m[3].HP=18,m[3].Max_HP=18,m[3].name=" 独眼怪 ";m[3].Speak="*样子怪怪的\n";
    	m[4].ATK=8,m[4].DEF=5,m[4].HP=30,m[4].Max_HP=30,m[4].name=" 小幽灵 ";m[4].Speak="*时常哭泣\n";
    	m[5].ATK=12,m[5].DEF=2,m[5].HP=31,m[5].Max_HP=31,m[5].name=" 爵士虫 ";m[5].Speak="*飘渺的对手\n"; 
    	m[6].ATK=9,m[6].DEF=8,m[6].HP=50,m[6].Max_HP=50,m[6].name=" 蛙吉特 ";m[6].Speak="*再见面\n";
    	m[7].ATK=2,m[7].DEF=10,m[7].HP=180,m[7].Max_HP=180,m[7].name=" 托丽尔 ";m[7].Speak="*亲爱的守护者\n";
    	m[8].ATK=19,m[8].DEF=32,m[8].HP=320,m[8].Max_HP=320,m[8].name=" 盾狗 ";m[8].Speak="*憨憨的模样\n";
    	m[9].ATK=46,m[9].DEF=41,m[9].HP=1020,m[9].Max_HP=1020,m[9].name=" 帕派瑞斯 ";m[9].Speak="*小天使\n";
    	m[10].ATK=5,m[10].DEF=184,m[10].HP=10089,m[10].Max_HP=10089,m[10].name=" 不灭的安黛因 ";m[10].Speak="*真正的女英雄\n";
    	m[11].ATK=1,m[11].DEF=1,m[11].HP=1,m[11].Max_HP=1,m[11].name=" 衫斯 ";m[11].Speak="*最简单的敌人\n*只能承受1点伤害\n";  
    }
    void Things_Define()
    {
    	tg[1].help_atk=0,tg[1].help_def=20,tg[1].help_hp=0,tg[1].Much_Buy=1,tg[1].name="提米薄片",tg[1].G=40,tg[1].Kind_Of=2;
    	tg[2].help_atk=0,tg[2].help_def=0,tg[2].help_hp=40,tg[2].Much_Buy=INF,tg[2].name="传说英雄",tg[2].G=280,tg[2].Kind_Of=3;
    	tg[3].help_atk=0,tg[3].help_def=0,tg[3].help_hp=60,tg[3].Much_Buy=INF,tg[3].name="蜘蛛蛋糕",tg[3].G=400,tg[3].Kind_Of=3;
    	tg[4].help_atk=10,tg[4].help_def=30,tg[4].help_hp=0,tg[4].Much_Buy=1,tg[4].name="平底锅",tg[4].G=500,tg[4].Kind_Of=2;
    	tg[5].help_atk=0,tg[5].help_def=0,tg[5].help_hp=0,tg[5].Much_Buy=1,tg[5].name="提米盔甲",tg[5].G=1700,tg[5].Kind_Of=2;
    	tg[6].help_atk=0,tg[6].help_def=0,tg[6].help_hp=0,tg[6].Much_Buy=INF,tg[6].name="甜甜圈套餐",tg[6].G=9999,tg[6].Kind_Of=3;
    } 
    void Ploblems_Define()
    {
    	p[1].pr="1&1",p[1].ans=1,p[1].spd=2;
    	p[2].pr="1|1",p[2].ans=1,p[2].spd=3;
    	p[3].pr="1^1",p[3].ans=0,p[3].spd=3;
    	p[4].pr="0&1",p[4].ans=0,p[4].spd=3;
    	p[5].pr="0&0",p[5].ans=0,p[5].spd=3;
    	p[6].pr="1|0",p[6].ans=1,p[6].spd=2;
    	p[7].pr="0^0",p[7].ans=0,p[7].spd=3;
    	p[8].pr="1^0",p[8].ans=1,p[8].spd=3;
    	p[9].pr="1&1^1",p[9].ans=0,p[9].spd=2;
    	p[10].pr="0|1|0",p[10].ans=1,p[10].spd=2;
    }
    void Get_File()
    {
    	system("cls");
    	FILE *fp=fopen("./undertale_cundang.txt","r");
    	Monster_Define();
    	Things_Define();
    	Ploblems_Define();
    	if(fp)
    	{
    		slowsay("检测到有存档,是否读档?(1/0):\n");
    		int aorpo;
    		cin>>aorpo;
    		if(aorpo)
    		{
    			for(int i=1;i<10;i++)
    			{
    				system("cls");
    				if(i%3==0)cout<<"正在读取存档中...";
    				if(i%3==1)cout<<"正在读取存档中.";
    				if(i%3==2)cout<<"正在读取存档中..";
    				Sleep(300);
    			}
    			int c,atk,def,mh,hp,exp,lv,st,hd,ha,hde;
    			fscanf(fp,"%d%d%d%d%d%d%d%d%d%d%d",&c,&atk,&def,&mh,&hp,&exp,&lv,&hd,&ha,&hde,&st);
    			for(int i=1;i<=hd;++i)
    			{
    				fscanf(fp,"%d",&y.Drug_Bag[i]);
    			}
    			for(int i=1;i<=ha;++i)
    			{
    				fscanf(fp,"%d",&y.ATK_Bag[i]);
    			}
    			for(int i=1;i<=hde;++i)
    			{
    				fscanf(fp,"%d",&y.DEF_Bag[i]);
    			}
    			fclose(fp);
    			y.ATK=atk,y.DEF=def,y.EXP=exp,y.G=c,y.Have_Drug=hd;y.Have_ATK=ha;
    			y.LV=lv,y.Max_HP=mh,y.name="Frisk";y.HP=hp;y.Stage=st;y.Have_DEF=hde;
    			slowsay("读取成功!");
    			Sleep(1000);
    			return;
    		}
    	}
    	Frisk_Define();
    }
    void Check_Kit_Draw(int li,int lj)
    {
    	printf("-----------------------------------\n\n");
    	bool flag=0;
    	if(li==1)
    	{
    		printf("[武器]      防具\n\n");
    		for(int i=1;i<=y.Have_ATK;++i)
    		{
    			lj==i?printf(">>"):printf("  ");
    			cout<<tg[y.ATK_Bag[i]].name<<'\n';
    		}
    		lj==y.Have_ATK+1?printf(">>退出\n"):printf("  退出\n");
    	}
    	else
    	{
    		flag=1;
    		printf(" 武器      [防具]\n\n");
    		for(int i=1;i<=y.Have_DEF;++i)
    		{
    			lj==i?printf(">>"):printf("  ");
    			cout<<tg[y.DEF_Bag[i]].name<<'\n';
    		}
    		lj==y.Have_DEF+1?printf(">>退出\n"):printf("  退出\n");
    	}
    	printf("-----------------------------------\n");
    	if((!flag && lj!=y.Have_ATK+1)||(flag && lj!=y.Have_DEF+1))
    	{
    		li==1?printf("*武器\n"):printf("*防具\n"); 
    		printf("*攻击+%d  防御+%d  血量+%d\n",tg[y.DEF_Bag[lj]].help_atk,tg[y.DEF_Bag[lj]].help_def,tg[y.DEF_Bag[lj]].help_hp);
    		printf("*输入k确认装备\n"); 	
    	}
    	printf("-----------------------------------\n");
    	return;
    }
    void Drug_Draw(int lj)
    {
    	printf("-----------------------------------\n");
    	int  d=y.Have_Drug;
    	for(int i=1;i<=d;++i)
    	{
    		lj==i?printf(">>"):printf("  ");
    		cout<<tg[y.Drug_Bag[i]].name<<endl;
    	}
    	lj==d+1?printf(">>退出\n"):printf("  退出\n");
    	printf("-----------------------------------\n");
    	printf("*药品  血量+%d\n",tg[y.Drug_Bag[lj]].help_hp);
    	printf("按k键丢弃\n");
    	printf("-----------------------------------\n");
    	return;
    }
    void Check_Yourself()
    {
    	system("cls");
    	printf("-----------------------------------\n");
    	printf("Frisk:\n");
    	printf("LV(等级):%d         EXP(经验):%d\n",y.LV,y.EXP);
    	printf("Max_HP(血量上限):%d\n",y.Max_HP);
    	printf("ATK(攻击):%d\n",y.ATK);
    	printf("DEF(防御):%d\n",y.DEF);
    	printf("HP(当前血量):%d\n",y.HP);
    	printf("CN(金币):%d\n",y.G);
    	cout<<"武器:"<<tg[y.knife].name<<"        防具:"<<tg[y.shield].name<<endl;
    	printf("BAG(背包):%d/10\n",y.Have_Drug);
    	for(int i=1;i<=y.Have_Drug;++i)
    	{
    		cout<<tg[y.Drug_Bag[i]].name<<"  "; 
    	}
    	printf("\n-----------------------------------\n输入1查看装备,2查看背包,3退出:");
    	int Your_Choose;
    	cin>>Your_Choose;
    	if(Your_Choose==1)
    	{
    		CHECK_AGAIN:
    		system("cls");
    		int HREAT_LINE=1,HREAT_ROW=1;
    		Check_Kit_Draw(HREAT_ROW,HREAT_LINE);
    		while(1)
    		{
    			Sleep(10);
    			if(kbhit())
    			{
    			    char x=_getch();
    				if(x=='w')
    				{
    					system("cls");
    					Check_Kit_Draw(HREAT_ROW,HREAT_LINE==1?1:--HREAT_LINE); 
    				}
    				else if(x=='s')
    				{
    					system("cls");
    					Check_Kit_Draw(HREAT_ROW,HREAT_ROW==1?(HREAT_LINE==y.Have_ATK+1?y.Have_ATK+1:++HREAT_LINE):(HREAT_LINE==y.Have_DEF+1?y.Have_DEF+1:++HREAT_LINE)); 
    				}
    				else if(x=='a')
    				{
    					system("cls");
    					HREAT_LINE=1;
    					Check_Kit_Draw(HREAT_ROW==1?1:--HREAT_ROW,1); 
    				}
    				else if(x=='d')
    				{
    					system("cls");
    					HREAT_LINE=1;
    					Check_Kit_Draw(HREAT_ROW==2?2:++HREAT_ROW,1); 
    				}
    				else if(x=='k' && ((HREAT_ROW==1&&HREAT_LINE==y.Have_ATK+1)||((HREAT_ROW==1&&HREAT_LINE==y.Have_DEF+1))) )
    				{
    					return;
    				}
    				else if(x=='k')
    				{
    					system("cls");
    					cout<<"装备成功!\n";
    					Sleep(1700);
    					if(HREAT_ROW==1)y.knife=y.ATK_Bag[HREAT_LINE];
    					if(HREAT_ROW==2)y.shield=y.DEF_Bag[HREAT_LINE];
    					goto CHECK_AGAIN;
    				} 
    			}
    		}
    	}
    	if(Your_Choose==2)
    	{
    		CHECK_AGAIN2:
    		system("cls");
    		int HREAT_LINE=1;
    		Drug_Draw(HREAT_LINE);
    		while(1)
    		{
    			Sleep(10);
    			if(kbhit())
    			{
    			    char x=_getch();
    				if(x=='w')
    				{
    					system("cls");
    					Drug_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
    				}
    				else if(x=='s')
    				{
    					system("cls");
    					Drug_Draw(HREAT_LINE==y.Have_Drug+1?HREAT_LINE:++HREAT_LINE); 
    				}
    				else if(x=='k' && HREAT_LINE==y.Have_Drug+1 )
    				{
    					return;
    				}
    				else if(x=='k')
    				{
    					system("cls");
    					cout<<"丢弃成功!\n";
    					Sleep(1700);
    					y.Drug_Bag[HREAT_LINE]=0;
    					for(int i=HREAT_LINE+1;i<=y.Have_Drug;++i)
    					{
    						y.Drug_Bag[i-1]=y.Drug_Bag[i];
    					}
    					y.Have_Drug--;
    					goto CHECK_AGAIN2;
    				} 
    			}
    		}
    	}
    	else 
    	{
    		return;
    	}
    }
    void ITEM_Draw(int lj)
    {
    	system("cls");
    	printf("-----------------------------------\n");
    	int  d=y.Have_Drug;
    	for(int i=1;i<=d;++i)
    	{
    		lj==i?printf(">>"):printf("  ");
    		cout<<tg[y.Drug_Bag[i]].name<<endl;
    	}
    	lj==d+1?printf(">>退出\n"):printf("  退出\n");
    	printf("-----------------------------------\n");
    }
    void M_FIGHT()
    {
    	system("cls");
    	cout<<"*怪物攻击!"<<endl; 
    	Sleep(500); 
    	int k=m[y.Stage].ATK,r=rand()%5+1;
    	while(r--)
    	{
    		int a=rand()%10+1;
    		int t=p[a].spd*1000,flag=0;
    		cout<<endl<<p[a].pr<<endl; 
    		while(t>0)
    		{
    			t-=100;
    			Sleep(100);
    			if(kbhit())
    			{
    				char x=_getch();
    				int my_ans=x-'0';
    				if(my_ans!=p[a].ans)
    				{
    					flag=2;
    					cout<<"回答错误!\n";
    					Sleep(200);
    					break;
    				}
    				else 
    				{
    					flag=1; 
    					cout<<"回答正确!\n";
    					Sleep(200);
    					break;
    				}
    			}
    		}
    		if(flag!=1)
    		{
    			if(flag==0)cout<<"超时!\n";
    			y.HP-=k;
    		}
    		Sleep(1000);
    	}
    }
    void FIGHT()
    {
    	double k=y.ATK+tg[y.knife].help_atk+tg[y.shield].help_atk;
    	system("cls");
    	//for循环1~100再到1攻击力 
    	double r=rand()%100+50;
    	k=floor(k*r/100.0);
    	if(m[y.Stage].name!="衫斯")
    	{
    		m[y.Stage].HP-=max(0,(int)k-m[y.Stage].DEF);
    		printf("你对怪物造成了 %d 点伤害!",max(0,(int)k-m[y.Stage].DEF)); 
    	} 
    	else
    	{
    		printf("你对怪物造成了 0 点伤害!"); 
    	}
    	if(m[y.Stage].HP<=0)
    	{
    		YOU_WON=1;int s=rand()%30+10,w=rand()%30+15;
    		Sleep(500);
    		slowsay("\n*你胜利了!");
    		printf("\n*你获得了 %d 点EXP和 %d 金币!\n",s,w); 
    		y.EXP+=s;y.G+=w;
    		if(y.EXP>=EXP_TO_LOVE[y.LV])
    		{
    			y.EXP-=EXP_TO_LOVE[y.LV];
    			y.LV++;
    			Sleep(200);
    			slowsay("*你升级了!\n"); 
    			y.Max_HP+=5;
    			y.ATK+=2;
    			y.DEF+=1;
    		}
    	}
    	Sleep(1000);
    }
    void ACT()
    {
    	system("cls");
    	printf("-----------------------------------\n");
    	slowsay("*");slowsay(m[y.Stage].name);slowsay(" ");cout<<m[y.Stage].ATK;
    	slowsay(" ATK ");cout<<m[y.Stage].DEF;slowsay(" DEF\n");
    	slowsay(m[y.Stage].Speak);
    	printf("-----------------------------------\n");
    	Sleep(500);
    	printf("按任意键继续:");
    	char o;
    	cin>>o;
    	return;
    }
    void ITEM()
    {
    	system("cls");
    	int HREAT_LINE=1;
    	ITEM_Draw(HREAT_LINE);
    	while(1)
    	{
    		Sleep(10);
    		if(kbhit())
    		{
    		    char x=_getch();
    			if(x=='w')
    			{
    				system("cls");
    				ITEM_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
    			}
    			else if(x=='s')
    			{
    				system("cls");
    				ITEM_Draw(HREAT_LINE==y.Have_Drug+1?HREAT_LINE:++HREAT_LINE); 
    			}
    			else if(x=='k' && HREAT_LINE==y.Have_Drug+1)
    			{
    				return;
    			}
    			else if(x=='k')
    			{
    				system("cls");
    				slowsay("*你吃掉了 ");slowsay(tg[y.Drug_Bag[HREAT_LINE]].name);
    				slowsay(" !\n*你恢复了");printf("%d",tg[y.Drug_Bag[HREAT_LINE]].help_hp);slowsay("点HP!");
    				Sleep(1700);
    				y.HP=min(y.Max_HP,y.HP+tg[y.Drug_Bag[HREAT_LINE]].help_hp);
    				y.Drug_Bag[HREAT_LINE]=0;
    				for(int i=HREAT_LINE+1;i<=y.Have_Drug;++i)
    				{
    					y.Drug_Bag[i-1]=y.Drug_Bag[i];
    				}
    				y.Have_Drug--;
    				system("cls");
    				return;
    			} 
    		}
    	}
    }
    void MERCY()
    {
    	system("cls");
    	int y=rand()%4+1;
    	if(y==4)
    	{
    		slowsay("你胜利了!");
    		slowsay("\n你获得了 0 点EXP和 0 金币!"); 
    		Sleep(1000);
    		YOU_WON=1;
    	}
    	else
    	{
    		slowsay("怪物拒绝了!");
    		Sleep(1000);
    	}
    	return;
    }
    void Fight_Draw()
    {
    	YOU_WON=0;
    	system("cls");
    	int s=y.Stage,hl;
    	slowsay("*");slowsay(m[s].name);slowsay("发起战斗!\n"); 
    	Sleep(300);
    	FIGHT_AGAIN:
    	if(YOU_WON==1)
    	{
    		y.Stage++;
    		return;
    	}
    	if(y.HP<=0)
    	{
    		system("cls");
    		printf("*(心碎)\n");
    		Sleep(2200);
    		slowsay("GAME   OVER\n");
    		Sleep(2000);
    		slowsay("*你是我们的希望...\n");
    		Sleep(1000);
    		slowsay("*Frisk,保持你的决心!");
    		Sleep(2000);
    		YOU_DIED=1;
    		return; 
    	}
    	system("cls");
    	cout<<m[s].name<<"   "<<m[s].HP<<"/"<<m[s].Max_HP<<endl;
    	printf("-----------------------------------\n");
    	slowsay("*尽管攻击!\n");
    	printf("FRISK %d / %d\n",y.HP,y.Max_HP);
    	printf("-----------------------------------\n");
    	hl=1;
    	hl==1?printf(">>[战斗]  "):printf("  [战斗]  "); 
    	hl==2?printf(">>[行动]  "):printf("  [行动]  "); 
    	hl==3?printf(">>[物品]  "):printf("  [物品]  "); 
    	hl==4?printf(">>[仁慈]  "):printf("  [仁慈]  ");  
    	while(1)
    	{
    		Sleep(10);
    		if(kbhit())
    		{
    		    char x=_getch();
    			if(x=='a')
    			{
    				system("cls");
    				hl==1?hl=1:hl--;
    				cout<<m[s].name<<"   "<<m[s].HP<<"/"<<m[s].Max_HP<<endl;
    				printf("-----------------------------------\n");
    				printf("*尽管攻击!\n");
    				printf("FRISK %d / %d\n",y.HP,y.Max_HP);
    				printf("-----------------------------------\n");
    				hl==1?printf(">>[战斗]  "):printf("  [战斗]  "); 
    				hl==2?printf(">>[行动]  "):printf("  [行动]  "); 
    				hl==3?printf(">>[物品]  "):printf("  [物品]  "); 
    				hl==4?printf(">>[仁慈]  "):printf("  [仁慈]  "); 
    		
    			}
    			else if(x=='d')
    			{
    				system("cls");
    				hl==4?hl=4:hl++;
    				cout<<m[s].name<<"   "<<m[s].HP<<"/"<<m[s].Max_HP<<endl;
    				printf("-----------------------------------\n");
    				printf("*尽管攻击!\n");
    				printf("FRISK %d / %d\n",y.HP,y.Max_HP);
    				printf("-----------------------------------\n");
    				hl==1?printf(">>[战斗]  "):printf("  [战斗]  "); 
    				hl==2?printf(">>[行动]  "):printf("  [行动]  "); 
    				hl==3?printf(">>[物品]  "):printf("  [物品]  "); 
    				hl==4?printf(">>[仁慈]  "):printf("  [仁慈]  "); 
    			}
    			else if(x=='k')
    			{
    				if(hl==1)FIGHT();
    				if(hl==2)ACT();
    				if(hl==3)ITEM();
    				if(hl==4)MERCY();
    				if(YOU_WON!=1)
    				{
    					M_FIGHT();
    				} 
    				goto FIGHT_AGAIN;
    			}
    		}
    	}
    	
    }
    void Start_Fight()
    {
    	system("cls");
    	cout<<"当前关数:"<<y.Stage<<"     "<<m[y.Stage].name<<endl;
    	Sleep(200);
    	slowsay("\nENTER K TO START!:");
    	char ys;
    	cin>>ys;
    	if(ys=='k' || ys=='K')
    	{
    		Fight_Draw();
    	} 
    	else
    	{
    		return;
    	}
    }
    int main()
    {
    	srand(time(0));
    	Get_File();
    	system("cls");
    	Sleep(3000);
    	slowsay("U N D E R T A L E");
    	Sleep(1000);
    	slowsay("\nby lingzai\n");
    	Sleep(2000);
    	cout<<"按任意键开始:";
    	char cin_to_start;int HREAT_LINE=1;
    	cin>>cin_to_start;
    	AGAIN:
    	if(YOU_DIED)
    	{
    		return 0;
    	}
    	system("cls");
    	Main_Draw(HREAT_LINE); 
        while(1)
    	{
    		Sleep(10);
    		if(kbhit())
    		{
    		    char x=_getch();
    			if(x=='w')
    			{
    				system("cls");
    				Main_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
    			}
    			else if(x=='s')
    			{
    				system("cls");
    				Main_Draw(HREAT_LINE==5?5:++HREAT_LINE); 
    			}
    			else if(x=='k')
    			{
    				if(HREAT_LINE==1)Buy_Things_From_Shop();
    				else if(HREAT_LINE==2)File();
    				else if(HREAT_LINE==3)Check_Yourself();
    				else if(HREAT_LINE==4)Start_Fight(); 
    				else if(HREAT_LINE==5)
    				{
    					system("cls");
    					Sleep(3000);
    					slowsay("U N D E R T A L E");
    					Sleep(1000);
    					slowsay("\n感谢游玩!\n");
    					return 0;
    				}
    				goto AGAIN;
    			}
    		}
    	}
    	return 0;
    }
    

    http://www.temege.com/user/2355

  • 通过的题目

题目标签

语言基础
106
循环语句
66
其他
38
竞赛
38
一维数组
32
选择语句
31
字符串
29
NOIP
28
语言入门
24
字符数组
22
搜索
18
普及组
18
二维数组
15
贪心
14
数学
13
位运算
12
年份
12
递归
10
排序
10
数据结构
10