Panyang11 @ 2024-10-24 18:27:23
记录1
记录2
记录3
by Tobyzeng1306 @ 2024-10-25 17:49:48
@scratch_szc 因为你没过60,所以看不到
by scratch_szc @ 2024-10-25 17:50:37
@Tobyzeng1306 6
by Tobyzeng1306 @ 2024-10-25 17:52:04
你确定他是故意的,是你没输出对
by scratch_szc @ 2024-10-25 17:52:56
@Tobyzeng1306 @Grammar__hbw 确实,我mle了,求改
#include<bits/stdc++.h>
using namespace std;
const int N=11;
int mp1[N][N];
int mp[N][N];
int fx[4]={1,0,-1,0};
int fy[4]={0,1,0,-1};
void tu(int x,int y){
//-1=可以走,-2不可以走
for(int i=1;i<=N;i++){
for(int j=1;j<=N;j++){
mp[i][j]==-1;
mp1[i][j]==-1;
}
mp[rand()%N+1][rand()%N+1]=-2;//随机数随机
mp1[rand()%N+1][rand()%N+1]=-2;
mp[N][N]=x;
mp1[N][N]=y;
}
}
int dfs1(int x,int y){//搜mp
for(int i=0;i<4;i++){
int dx=x+fx[i],dy=y+fy[i];
if(dx<N&&dx>0&&dy<N&&dy>0&&mp[dx][dy]!=-2)dfs1(dx,dy);
if(dx==N&&dy==N)return mp[N][N];
}
}
int dfs2(int x,int y){//搜mp1
for(int i=0;i<4;i++){
int dx=x+fx[i],dy=y+fy[i];
if(dx<N&&dx>0&&dy<N&&dy>0&&mp1[dx][dy]!=-2)dfs2(dx,dy);
if(dx==N&&dy==N)return mp1[N][N];
}
}
int main(){
srand(time(NULL));
int a,b;
scanf("%d%d",&a,&b);
tu(a,b);
int t=dfs1(1,1);
int v=dfs2(1,1);
cout<<t+v;
}
by Lucas2024 @ 2025-01-02 20:04:07