lsh的
旧
主页:
首红:B2002 Hello,World! 2023-09-16 16:21
首橙: P5723 【深基4.例13】质数口袋 2023-12-13 16:25
首黄:P5461 赦免战俘 2024-01-12 20:48 Chiesl代做
真-首黄:P1007 独木桥 2024-02-07 16:23
万能TLE程序:
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
int main(){
while(1) sleep(114514);
return 0;
}
小游戏:
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int life=25,life_=25,g1=2,g2=4,g3=8,leng1,leng2,fang=0,expe=0,level=1,money=15;
int zx=1;
int life2,mi,ma,fang2;
int rands(int a,int b){
srand(time(NULL));
return rand()%(b-a)+a;
}
void slowly(string a){
for(int i=0;a.size();i++){
cout<<a[i];
Sleep(10);
}
}
int ff(int a,int b){
if(a>=b) return 0;
else{
return b-a;
}
}
int main(){
int j1=1,j2=1,j3=1;
int j,die;
//freopen("骑士","r",stdin);
//cin>>life_>>g1>>g2>>g3>>j1>>j2>>j3>>zx>>money>>expe>>level;
//fclose(stdin);
if(zx==1){
Sleep(1000);
printf("你是一名骑士\n");
Sleep(1000);
printf("经常在外面扫黑除恶\n");
Sleep(1000);
printf("这一天,你遇到了一只恶鬼\n");
Sleep(1000);
printf("它向你扑了过来!\n");
Sleep(1000);
system("cls");
int die,j;
leng1=0;
leng2=0;
life2=20;
while(!(life<=0||life2<=0)){
if(leng1<=0) leng1=0;
if(leng2<=0) leng2=0;
printf("你的血量:%d 你的防御:%d 怪物的血量:%d 怪物的防御:%d\n",life,fang,life2,fang2);
printf("1:普攻(伤害:%d) 2:大力斩击(伤害:%d,冷却%d) 3:圣剑冲击斩(伤害:%d,冷却%d)\n",g1,g2,leng1,g3,leng2);
cin>>j;
if(j==1){
life2-=ff(fang2,g1);
printf("造成了%d点伤害!\n",ff(fang2,g1));
}
if(j==2){
if(leng1==0){
life2-=ff(fang2,g2);
printf("造成了%d点伤害!\n",ff(fang2,g2));
leng1=2;
}
else{
printf("冷却中!\n");
Sleep(1000);
system("cls");
continue;
}
}
if(j==3){
if(leng2==0){
life2-=ff(fang2,g3);
printf("造成了%d点伤害!\n",ff(fang2,g3));
leng2=3;
}
else{
printf("冷却中!\n");
Sleep(1000);
system("cls");
continue;
}
}
Sleep(1000);
int s=rands(2,6);
printf("恶鬼造成了%d点伤害!\n",ff(fang,s));
life-=ff(fang,s);
Sleep(1000);
if(life<=0&&life2<=0){
MessageBox(NULL,"你与恶鬼双双倒地了!\n","同归于尽",MB_OK);
life=life_;
life2=20;
continue;
}
if(life<=0){
MessageBox(NULL,"恶鬼击败了你!\n","你失败了",MB_OK);
life=life_;
life2=20;
continue;
}
if(life2<=0){
die=1;
}
system("cls");
leng1--;
leng2--;
}
if(die==1){
printf("一股力量从恶鬼体内喷涌而出!\n");
expe+=5;
Sleep(1000);
}
}
int commana,commanb,commanc;
string name[100]={"0","黑暗狼狗","夜魔","红色史莱姆","天狗","大蛇","变异蜥蜴王","空中飞鳗","地狱犬","双头地狱犬","(BOSS)三头地狱犬",
"鲲","鹏","电锤战士","黑色巨人","卐","魔化的烈焰剑士","超级盾甲","光之战士","风魔","(BOSS)完美防御之神",
"初阶骨法师","弹珠喷射魔蛙","死灵法师","进阶骨法师","幻术鲲","归来的恶鬼","黑化剑圣","嗜血者"};
int lifes[100]={0,22,28,35,44,54,66,75,88,100,145,
167,194,228,256,124,279,427,404,432,85,476,512,555,586,605,653,682,709};
int gongs1[100]={0,3,4,4,5,5,6,6,7,8,11,
11,12,13,15,19,21,25,45,28,50,
44,48,52,54,57,59,62,65};
int gongs2[100]={0,6,6,7,7,8,8,9,10,12,16,
16,18,36,29,37,39,45,92,68,100,
98,100,105,109,114,120,125,136};
int fangs[100]={0,1,1,2,2,3,4,4,5,5,8,
9,9,10,12,25,16,32,20,24,64,
48,50,52,54,56,58,60,62};
int moneys[100]={0,8,9,10,12,15,18,20,30,38,65,
45,50,55,58,62,68,80,82,88,124,
100,105,110,115,120,100,110,120};
while(1){
if(expe>=level*5){
while(expe>=level*5){
expe-=level*5;
system("cls");
printf("你升级了!\n");
printf("1:攻击+2 2:生命+10 3:防御+1\n");
cin>>j;
if(j==1){
g1+=2;
g2+=2;
g3+=2;
}
if(j==2){
life_+=10;
}
if(j==3){
fang+=1;
}
printf("已升级!\n");
level++;
Sleep(1000);
}
}
life=life_;
system("cls");
printf("1:主线:");
cout<<name[zx];
printf("(血量:%d,攻击:%d~%d,防御:%d)",lifes[zx],gongs1[zx],gongs2[zx],fangs[zx]);
printf(" 2:属性 3:旅行商店 \n");
cin>>commana;
system("cls");
if(commana==1){
life2=lifes[zx];
leng1=leng2=0;
fang2=fangs[zx];
while(!(life<=0||life2<=0)){
if(leng1<=0) leng1=0;
if(leng2<=0) leng2=0;
printf("你的血量:%d 你的防御:%d 怪物的血量:%d 怪物的防御:%d\n",life,fang,life2,fang2);
printf("1:普攻(伤害:%d) 2:大力斩击(伤害:%d,冷却%d) 3:圣剑冲击斩(伤害:%d,冷却%d)\n",g1,g2,leng1,g3,leng2);
cin>>j;
if(j==1){
for(int i=1;i<=j1;i++){
printf("造成了%d点伤害!\n",ff(fang2,g1));
life2-=ff(fang2,g1);
}
}
if(j==2){
if(leng1==0){
if(j2==2){
life2-=ff(fang2,g2*3/2);
printf("造成了%d点伤害!\n",ff(fang2,g2*3/2));
}
else if(j2==1){
life2-=ff(fang2,g2);
printf("造成了%d点伤害!\n",ff(fang2,g2));
}
leng1=2;
}
else{
printf("冷却中!\n");
Sleep(1000);
system("cls");
continue;
}
}
if(j==3){
if(leng2==0){
life2-=ff(fang2,g3);
printf("造成了%d点伤害!\n",ff(fang2,g3));
leng2=3;
if(j3==2){
life+=ff(fang2,g3)/4;
printf("吸取了%d的血量!\n",ff(fang2,g3)/4);
}
}
else{
printf("冷却中!\n");
Sleep(1000);
system("cls");
continue;
}
}
Sleep(1000);
int s=rands(gongs1[zx],gongs2[zx]);
printf("怪物造成了%d点伤害!\n",ff(fang,s));
if(zx==28){
printf("怪物吸取了%d的血量!\n",ff(fang,s)/10*4);
life2+=ff(fang,s)/10*4;
}
life-=ff(fang,s);
Sleep(1000);
if(life<=0&&life2<=0){
MessageBox(NULL,"你与怪物双双倒地了!\n","同归于尽",MB_OK);
life=life_;
life2=lifes[zx];
leng1=0;
leng2=0;
continue;
}
if(life<=0){
MessageBox(NULL,"怪物击败了你!\n","你失败了",MB_OK);
life=life_;
life2=lifes[zx];
leng1=0;
leng2=0;
system("cls");
continue;
}
if(life2<=0){
die=1;
}
system("cls");
leng1--;
leng2--;
}
if(die==1){
printf("一股力量从怪物体内喷涌而出!\n");
Sleep(1000);
printf("经验值+%d!\n金币+%d!\n",level*(zx+1),moneys[zx]);
zx++;
money+=moneys[zx];
expe+=5*zx;
Sleep(1000);
}
}
if(commana==2){
printf("属性:\n血量:%d\n攻击加成:%d\n防御:%d\n等级:%d\n经验:%d/%d\n金币数量:%d",life_,g1-2,fang,level,expe,level*5,money);
Sleep(3000);
system("cls");
}
if(commana==3){
system("cls");
printf("旅行商店:\n");
printf("商人:来看看有什么需要的吧!\n",money);
shop:{
system("cls");
printf("你拥有%d个金币\n",money);
printf("1:生命强化密卷(5金币 生命上限+6) 2:力量强化密卷(4金币 攻击+1) 3:防御强化密卷(6金币 防御+1) 4:技能强化书-圣剑冲击斩(28金币 技能附带25%吸血) 5:技能强化书-大力斩击(36金币 技能伤害+50%) 6:经验卷轴(8金币 经验+15) 7:普攻强化(55金币 造成3次伤害)8:离开\n");
cin>>commanb;
if(commanb==1){
if(money>=5){
printf("你的生命属性获得了强化!\n");
money-=5;
life_+=6;
}
else{
printf("你没有足够的金币!\n");
}
Sleep(1000);
goto shop;
}
if(commanb==2){
if(money>=4){
printf("你的攻击属性获得了强化!\n");
money-=4;
g1+=1;
g2+=1;
g3+=1;
}
else{
printf("你没有足够的金币!\n");
}
Sleep(1000);
goto shop;
}
if(commanb==3){
if(money>=6){
printf("你的防御属性获得了强化!\n");
money-=6;
fang+=1;
}
else{
printf("你没有足够的金币!\n");
}
Sleep(1000);
goto shop;
}
if(commanb==4){
if(j3>=2){
printf("你的技能已经强化过了!\n");
goto shop;
}
if(money>=28){
printf("你的圣剑冲击斩获得了强化!\n");
money-=28;
j3=2;
}
else{
printf("你没有足够的金币!\n");
}
Sleep(1000);
goto shop;
}
if(commanb==5){
if(j2>=2){
printf("你的技能已经强化过了!\n");
}
if(money>=36){
printf("你的大力斩击获得了强化!\n");
money-=36;
j2=2;
}
else{
printf("你没有足够的金币!\n");
}
Sleep(1000);
goto shop;
}
if(commanb==6){
if(money>=8){
printf("经验值+15!\n");
money-=8;
expe+=15;
}
else{
printf("你没有足够的金币!\n");
}
Sleep(1000);
goto shop;
}
if(commanb==7){
if(j1>=3){
printf("你的技能已经强化过了!\n");
}
if(money>=55){
printf("你的普攻获得了强化!\n");
money-=55;
j1=3;
}
else{
printf("你没有足够的金币!\n");
}
Sleep(1000);
goto shop;
}
if(commanb==8){
printf("你离开了旅行商店!\n");
Sleep(1000);
}
}
}
}
}