题解 3037: 棋盘问题

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

棋盘问题3037:python

摘要:解题思路:注意事项:参考代码:n,k=map(int,input().split())b=[]while n!=-1 and k!=-1: a=[]  ……

看似棋盘,实则组合!DFS拿下!看这一篇就够了!!!

看似是个棋盘问题,实际上是个组合问题注释没有写太多(因为作者懒)自己复制到编译器看看吧相信你一定能看懂!!!(本蒟蒻写的代码不可能高大上)#includeusingnamespacestd;intn,k;vectorss;intnum;intq;intdx[10]={0};//行数组int

3037: 棋盘问题-深度优先搜索

#include#includeusingnamespacestd;intn,k,ans=0;stringmaze[10];boolcol[10];voiddfs(intr,intm){if(m==k){ans++;return;}if(r==n)return;for(inti=0;i>n>>k;wh