![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法学习
CnZBin
这个作者很懒,什么都没留下…
展开
-
virtual Judge-棋盘问题题解
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n当为...原创 2020-04-20 11:29:19 · 407 阅读 · 0 评论 -
Virtual Judge - Catch That Cow 题解答案
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,0...原创 2020-04-19 11:27:46 · 351 阅读 · 0 评论 -
Virtual Judge -Lake Counting 挑战程序设计深搜
Lake CountingDue to recent rains, water has pooled in various places in Farmer John’s field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each squa...原创 2020-04-09 11:58:49 · 137 阅读 · 0 评论 -
Virtual Judge - Property Distribution题解
Property Distribution题目*タナカ氏が HW アールの果樹園を残して亡くなりました。果樹園は東西南北方向に H × W の区画に分けられ、区画ごとにリンゴ、カキ、ミカンが植えられています。タナカ氏はこんな遺言を残していました。果樹園は区画単位でできるだけ多くの血縁者に分けること。ただし、ある区画の東西南北どれかの方向にとなりあう区画に同じ種類の果物が植えられていた場合は、...原创 2020-04-08 16:54:40 · 164 阅读 · 0 评论 -
virtual Judge 刷题 Red and Black
Red and Black题目描述There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile.From a tile, he can move to one of four adjacent...原创 2020-04-07 15:59:57 · 269 阅读 · 0 评论 -
递归求全排列的学习与理解
递归求全排列的学习与理解全排列:从n个不同元素中任取m(m≤n)个元素,按照一定的顺序排列起来,叫做从n个不同元素中取出m个元素的一个排列。当m=n时所有的排列情况叫全排列。比如:求1~3的全排列由中学的知识便知共有 3! =3 x 2 x 1=6种 排列,即123,132,213,231,312,321那么该怎么用代码求出来呢?像我这种萌新,一开始想到的当然是用for循环,但是求...原创 2020-04-06 23:04:25 · 570 阅读 · 0 评论