摘要: D. Restore Permutation D. Restore Permutation An array of integers p1,p2,…,pnp1,p2,…,pn is called a permutation if it contains each number from 11 to  阅读全文
posted @ 2019-09-13 16:02 杰瑞与汤姆 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Binary Tree Traversals Problem Description A binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint bin 阅读全文
posted @ 2019-09-13 15:45 杰瑞与汤姆 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 连连看 Problem Description “连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我 阅读全文
posted @ 2019-09-13 15:41 杰瑞与汤姆 阅读(129) 评论(0) 推荐(0) 编辑
摘要: N皇后问题 Problem Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input 共有若干行,每行一个正整数N≤10,表示棋盘和 阅读全文
posted @ 2019-09-13 15:13 杰瑞与汤姆 阅读(144) 评论(0) 推荐(0) 编辑