摘要: 题目链接:http://codeforces.com/gym/100971/problem/J Vitaly works at the warehouse. The warehouse can be represented as a grid of n × m cells, each of whic 阅读全文
posted @ 2018-07-17 22:53 两点够吗 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1163 Description 73 88 1 02 7 4 44 5 2 6 5(Figure 1) Figure 1 shows a number triangle. Write a program that calculates 阅读全文
posted @ 2018-07-16 23:18 两点够吗 阅读(253) 评论(0) 推荐(0) 编辑
摘要: Description 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,00 阅读全文
posted @ 2018-07-15 13:39 两点够吗 阅读(577) 评论(0) 推荐(0) 编辑
摘要: 题目:在N*N的国际象棋棋盘上放置N个皇后彼此不受攻击(即在棋盘的任一行,任一列和任意对角线上不能放置2个皇后),求解所有摆放方案的总数。 样例输入: 1 8 样例输出: 1 92 解题思路:由于皇后的摆放位置不能通过某种公式确定,因此对于每个皇后的摆放位置都要进行试探和纠正,这就是“回溯”的思想。 阅读全文
posted @ 2018-07-13 12:30 两点够吗 阅读(1176) 评论(0) 推荐(0) 编辑
摘要: 题目:给定一个大小为N*M的迷宫,迷宫由通道('.')和墙壁('#')组成,其中通道S表示起点,通道G表示终点,每一步移动可以达到上下左右中不是墙壁的位置。试求出起点到终点的最小步数。(本题假定迷宫是有解的)(N,M<=100) 输入: 10 10#S######.#......#..#.#.##. 阅读全文
posted @ 2018-07-13 08:42 两点够吗 阅读(1728) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=2386 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented b 阅读全文
posted @ 2018-07-12 20:17 两点够吗 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3253 Description Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and 阅读全文
posted @ 2018-07-12 18:09 两点够吗 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3617 Description FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this 阅读全文
posted @ 2018-07-12 12:48 两点够吗 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 生成1~n的排列 我们尝试用递归的思想解决:先输出所有以1开头的排列(这一步是递归调用),然后 输出以2开头的排列(又是递归调用),接着是以3开头的排列……最后才是以n开头的排 列。 以1开头的排列的特点是:第一位是1,后面是2~9的排列。根据字典序的定义,这些2 ~9的排列也必须按照字典序排列。换 阅读全文
posted @ 2018-07-11 14:47 两点够吗 阅读(2631) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://vjudge.net/problem/UVA-10976 It is easy to see that for every fraction in the form 1k(k > 0), we can always find two positive integers x 阅读全文
posted @ 2018-07-11 13:06 两点够吗 阅读(420) 评论(0) 推荐(0) 编辑