女孩子的试炼攻略:
#include<cstdio>
#include"windows.h"
int hp0=515,atk1=10,dex1=10;
int monstercount=19;
int bounscount=33;
int allmonster=7;
struct enemys{
short hp,atk,dex,spj;
}enemy[7];
short allstatus[524288]={};
char atk0[524288]={};
char dex0[524288]={};
char mdef[524288]={};
short extrahp[524288]={};
int pre[524288]={};
int enemy2[19]={};
char bouns[38]={};
short fight(short myhp,short myatk,short mydex,short mymdef,short enemyhp,short enemyatk,short enemydex,short spj)
{
if(spj==1)mydex=0;
if(spj==2)myatk=enemydex+1;
if(spj==3)enemyhp+=(myatk-enemydex);
short damage=(enemyhp-1)/(myatk-enemydex)*(enemyatk-mydex);
if(spj==4)damage*=2;
damage-=mymdef;
if(damage<0)damage=0;
return myhp-damage;
}
struct pos{
int x,y;}
yellowdoor[4],bluedoor[3],monster[20]={};
char enemys[19]={3,3,2,4,0,2,3,3,1,5,0,1,5,5,1,1,2,4,6};
char map[13][13]={
{04,9,11,00,05,11,37,11,04,00,11,9,05},
{11,11,11,04,11,00,13,00,11,05,11,11,11},
{11,00,36,00,11,06,00,35,11,00,34,00,11},
{06,33,00,11,32,00,11,05,04,11,00,31,07},
{04,12,00,04,00,11,11,11,11,11,07,12,04},
{13,00,07,00,30,00,07,00,06,11,29,00,11},
{05,28,11,00,11,11,11,11,00,27,00,07,11},
{07,11,00,26,11,07,05,11,11,11,11,00,11},
{11,9,11,00,00,11,25,06,11,07,11,24,04},
{07,11,23,00,00,00,00,12,05,00,11,00,11},
{06,00,06,11,22,11,00,11,21,11,11,07,11},
{11,20,13,05,00,12,00,00,00,00,11,00,11},
{07,00,04,11,11,11,00,11,00,19,00,05,11}
};
char map1[13][13]={};
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
void clear()
{
for(int i=0;i<524288;i++)
allstatus[i]=atk0[i]=dex0[i]=mdef[i]=extrahp[i]=pre[i]=0;
allstatus[0]=hp0;
}
int check()
{
int maxx=0;int pos=0;
for(int i=262144;i<524288;i++)
if(allstatus[i]>maxx)
maxx=allstatus[i],pos=i;
return pos;
}
void out(int st)
{
int uju=st;
int tail=0;
int route[20]={};
while(st)
{
route[tail++]=st;
st=pre[st];
}
printf("\n路线:\nhp:%d\n",allstatus[uju]);
for(int i=tail-1;i>=0;i--)
printf("%x\n",route[i]);
}
void dynamic()
{
for(int i=1;i<524288;i++)
{
if(i==0x20094)
int dfgsdfgdf=0;
for(int j=0;j<19;j++)
{
int k=1<<j;
if((i&k)&&allstatus[i^k]>0&&(enemy2[j]==-1||(enemy2[j]&(i^k))))
{
int tmp=fight(allstatus[i^k],atk0[i^k],dex0[i^k],mdef[i^k],enemy[enemys[j]].hp,enemy[enemys[j]].atk,enemy[enemys[j]].dex,enemy[enemys[j]].spj);
if(tmp<=0)continue;
tmp+=extrahp[i]-extrahp[i^k];
if(tmp>allstatus[i])
allstatus[i]=tmp,pre[i]=i^k;
}
}
}
}
void bfs(int st,int x,int y)
{
if(st==343434)
int gdfgsdf=0;
bool tgt[13][13]={};
int tou=0,wei=0;
pos q[444]={};
q[0].x=x,q[0].y=y;
tgt[x][y]=1;
while(tou<=wei)
{
int tx=q[tou].x,ty=q[tou].y;
for(int i=0;i<4;i++)
{
int txx=tx+dx[i],tyy=ty+dy[i];
if(txx<13&&txx>=0&&tyy<13&&tyy>=0&&tgt[txx][tyy]==0&&map1[txx][tyy]<10)
q[++wei].x=txx,q[wei].y=tyy,tgt[txx][tyy]=1;
}
tou++;
}
for(int i=0;i<13;i++)
for(int j=0;j<13;j++)
if(tgt[i][j])
switch(map1[i][j])
{
case 4:
atk0[st]++;
break;
case 5:
dex0[st]++;
break;
case 6:
mdef[st]+=4;
break;
case 7:
extrahp[st]+=40;
break;
case 9:
extrahp[st]+=193;
break;
default:
break;
}
}
void bfs3(int x,int y)
{
bool tgt[13][13]={};
int tou=0,wei=0;
pos q[444]={};
q[0].x=x,q[0].y=y;
tgt[x][y]=1;
while(tou<=wei)
{
int tx=q[tou].x,ty=q[tou].y;
for(int i=0;i<4;i++)
{
int txx=tx+dx[i],tyy=ty+dy[i];
if(txx<13&&txx>=0&&tyy<13&&tyy>=0&&tgt[txx][tyy]==0&&map[txx][tyy]<10)
q[++wei].x=txx,q[wei].y=tyy,tgt[txx][tyy]=1;
}
tou++;
}
bool tgt2[13][13]={};
for(int i=0;i<19;i++)
enemy2[i]=-2;
for(int i=0;i<19;i++)
{
int tmpx=monster[i].x,tmpy=monster[i].y;
for(int j=0;j<4;j++)
{
int txx=tmpx+dx[j],tyy=tmpy+dy[j];
if(txx<13&&txx>=0&&tyy<13&&tyy>=0&&tgt[txx][tyy])
{enemy2[i]=-1;break;}
}
}
for(int i=0;i<524288;i++)
atk0[i]+=atk1,dex0[i]+=dex1;
}
int bfs2(int x,int y)
{
int tmp=map[x][y];
bool tgt[13][13]={};
map[x][y]=0;
int tou=0,wei=0;
pos q[444]={};
q[0].x=x,q[0].y=y;
tgt[x][y]=1;
while(tou<=wei)
{
int tx=q[tou].x,ty=q[tou].y;
for(int i=0;i<4;i++)
{
int txx=tx+dx[i],tyy=ty+dy[i];
if(txx<13&&txx>=0&&tyy<13&&tyy>=0&&tgt[txx][tyy]==0&&map[txx][tyy]<10)
q[++wei].x=txx,q[wei].y=tyy,tgt[txx][tyy]=1;
}
tou++;
}
bool tgt2[13][13]={};
int res=0;
for(int i=0;i<19;i++)
{
int tmpx=monster[i].x,tmpy=monster[i].y;
for(int j=0;j<4;j++)
{
int txx=tmpx+dx[j],tyy=tmpy+dy[j];
if(txx<13&&txx>=0&&tyy<13&&tyy>=0&&tgt[txx][tyy])
{res|=(1<<i);break;}
}
}
map[x][y]=tmp;
return res;
}
void init()
{
clear();
for(int i=0;i<524288;i++)
{
if(i==524000)
int dfsgfgsd=0;
for(int j=0;j<13;j++)
for(int k=0;k<13;k++)
map1[j][k]=map[j][k];
for(int j=0;j<19;j++)
if(i&(1<<j))
map1[monster[j].x][monster[j].y]=0;
bfs(i,12,6);
}
bfs3(12,6);
for(int i=0;i<19;i++)
{
if(i==17)
int dfgsdfgf=0;
if(enemy2[i]==-2)
enemy2[i]=bfs2(monster[i].x,monster[i].y);
}
}
int main()
{
int tot=0;
for(int i=12;i>=0;i--)
for(int j=12;j>=0;j--)
if(map[i][j]>=19)
monster[tot].x=i,monster[tot].y=j,tot++;
enemy[0].hp=80,enemy[0].atk=11,enemy[0].dex=3,enemy[0].spj=1;
enemy[1].hp=8,enemy[1].atk=28,enemy[1].dex=0,enemy[1].spj=2;
enemy[2].hp=96,enemy[2].atk=21,enemy[2].dex=2,enemy[2].spj=3;
enemy[3].hp=54,enemy[3].atk=28,enemy[3].dex=1,enemy[3].spj=4;
enemy[4].hp=39,enemy[4].atk=50,enemy[4].dex=4,enemy[4].spj=0;
enemy[5].hp=60,enemy[5].atk=23,enemy[5].dex=9,enemy[5].spj=0;
enemy[6].hp=390,enemy[6].atk=26,enemy[6].dex=5,enemy[6].spj=0;
yellowdoor[0].x=4,yellowdoor[0].y=1;
yellowdoor[1].x=11,yellowdoor[1].y=5;
yellowdoor[2].x=9,yellowdoor[2].y=7;
yellowdoor[3].x=4,yellowdoor[3].y=11;
bluedoor[0].x=1,bluedoor[0].y=6;
bluedoor[1].x=5,bluedoor[1].y=0;
bluedoor[2].x=11,bluedoor[2].y=2;
for(int i=0;i<13;i++)
for(int j=0;j<13;j++)
{
if(map[i][j]==11)
{
map[i][j]=0;
for(int k1=0;k1<3;k1++)
for(int k2=k1+1;k2<4;k2++)
{
map[yellowdoor[k1].x][yellowdoor[k1].y]=0;
map[yellowdoor[k2].x][yellowdoor[k2].y]=0;
for(int k3=0;k3<3;k3++)
{
printf("%d %d %d %d %d\n",i,j,k1,k2,k3);
map[bluedoor[k3].x][bluedoor[k3].y]=0;
init();
dynamic();
FILE* fp=fopen("debug.log","wb");
for(int i=0;i<524288;i++)
if(allstatus[i])
fprintf(fp,"%x %d %d %d %d %d\n",i,atk0[i],dex0[i],mdef[i],extrahp[i],allstatus[i]);
int tmp=check();
if(tmp>0){out(tmp);
printf("\n破墙%d %d 黄门%d %d 蓝门 %d\n",i,j,k1,k2,k3);}
map[bluedoor[k3].x][bluedoor[k3].y]=13;
}
map[yellowdoor[k1].x][yellowdoor[k1].y]=12;
map[yellowdoor[k2].x][yellowdoor[k2].y]=12;
}
map[i][j]=11;
}
}
}
|