随笔分类 - 搜索-dfs
摘要:题目: 如下的10个格子: 答案:1580 你有0~9十个数,每个数只能用一次,且连续的数不能放在相邻的格子里(上下,左右对角都算相邻) 思路:模拟每个位置能放的数,DFS;递归深度为格子的个数,每个格子有10种选择:0~9,从左上角格子出发,递归出口为到达右下角: 代码:
阅读全文
摘要:Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7.
阅读全文

浙公网安备 33010602011771号