摘要: 题目 上一题用了递归,这次用栈 ``` class Solution {public: int ans=0; int a[100][100]; int m; int x[100005]; int y[100005]; int s[100005]; int p[100005]; int totalNQ 阅读全文
posted @ 2019-08-27 19:15 Shendu.CC 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 题目 N 皇后问题。 其实就是DFS或者BFS的入门题。 要是可以用位运算来模拟皇后的摆放和棋盘,那么代码就很优雅了。 class Solution { public: vector<vector<string>> ans; int a[100][100]; int m; vector<vector 阅读全文
posted @ 2019-08-27 15:33 Shendu.CC 阅读(98) 评论(0) 推荐(0) 编辑