深度优先搜索
基金爱好者
这个作者很懒,什么都没留下…
展开
-
22.FJ字符串
#include <iostream>using namespace std;string dfs(int n) { if(n == 1) { return "A"; } else { return dfs(n-1) + (char)(n + 'A' - 1) + dfs(n - 1); }}int main(){ ...原创 2018-02-28 22:45:47 · 117 阅读 · 0 评论 -
PAT甲级1004(深搜)
Counting Leaves (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A family hierarchy is usually presented by a pedigree tree. Your job is to count those family membe...原创 2018-02-28 21:51:28 · 162 阅读 · 0 评论 -
PAT甲级1003(深搜)
Emergency (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue As an emergency rescue team leader of a city, you are given a special map of your country. The map shows ...原创 2018-02-28 21:48:45 · 252 阅读 · 0 评论 -
卡片换位
你玩过华容道的游戏吗? 这是个类似的,但更简单的游戏。 看下面 3 x 2 的格子+—+—+—+ | A | * | * | +—+—+—+ | B | | * | +—+—+—+在其中放5张牌,其中A代表关羽,B代表张飞,* 代表士兵。 还有一个格子是空着的。你可以把一张牌移动到相邻的空格中去(对角不算相邻)。 游戏的目标是:关羽和张飞交换位置,其它的牌随便在哪里...原创 2018-03-21 20:40:10 · 868 阅读 · 0 评论