![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索
hyqsblog
这个作者很懒,什么都没留下…
展开
-
埃及分数
题目描述 Description 在古埃及,人们使用单位分数的和(形如1/a的, a是自然数)表示一切有理数。 如:2/3=1/2+1/6,但不允许2/3=1/3+1/3,因为加数中有相同的。 对于一个分数a/b,表示方法有很多种,但是哪种最好呢? 首先,加数少的比加数多的好,其次,加数个数相同的,最小的分数越大越 好。 如: 19/45=1/3 + 1/12 + 1/180 19/45=原创 2015-04-19 16:30:23 · 601 阅读 · 0 评论 -
11214 - Guarding the Chessboard
Problem GGuarding the ChessboardGiven an n*m chessboard with some marked squares, your task is to place as few queens as possible to guard (attack or occupy) all marked squares. Below is a solution to原创 2015-07-19 19:52:21 · 418 阅读 · 0 评论 -
12569 - Planning mobile robot on Tree (EASY Version)
我有话说: 这是一道bfs。因为他要移动每一个石头或者机器人。换成dfs的话,一个是不知道目标状态(最小步数),二是容易爆栈。既然是bfs,那么要考虑一下如何判重,想法是转换成二进制,对于编号上的格子是否有石头或者机器人采用1或0表示。但是,数组开太小会RE太大会TLE,后来看了一个大神的题解,选择了一个恰好的maxstate。#include <iostream>#includ原创 2015-07-20 10:02:23 · 394 阅读 · 0 评论 -
1343 - The Rotation Game
The rotation game uses a # shaped board, which can hold 24 pieces of square blocks (see Fig.1). The blocks are marked with symbols 1, 2 and 3, with exactly 8 pieces of each kind. Initially, the blocks原创 2015-07-19 13:00:12 · 265 阅读 · 0 评论 -
10384 - The Wall Pushers
我有话说: 用了迭代加深搜索。主要就考虑两类。没有墙和有墙但是能推的两种情况。分别进行枚举。比较麻烦的不是程序过程,而是由于题目中x y坐标的设定,以及推墙后的运算,要有清晰的思路。#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;co原创 2015-07-20 16:17:28 · 455 阅读 · 0 评论 -
690 - Pipeline Scheduling
Pipeline Scheduling An arithmetic pipeline is designed to process more than one task simultaneously in an overlap- ping manner. It includes function units and data paths among them. Tasks are process原创 2015-07-20 20:18:39 · 564 阅读 · 0 评论 -
818 - Cutting Chains
Cutting Chains What a find! Anna Locke has just bought several links of chain some of which may be connected. They are made from zorkium, a material that was frequently used to manufacture jewelry in原创 2015-07-21 09:21:43 · 439 阅读 · 0 评论 -
11882 - Biggest Number
题目大意: 给出nXm的矩阵方格。其中有一些是数字,有一些是#即障碍。 可以从任何一个数字个开始,取走格中的数字。不能走到障碍上,也不能经过同一个数字格两次。问所能得到的最大数字。 我有话说: 很明显是搜索。但是裸搜是肯定超时的。所以这道题可以说是剪枝的试验田。在写之前,我参看了网上大神们的各种强剪枝。最后写了一下代码。但因为自己两个小错误看了一原创 2015-07-21 13:17:52 · 652 阅读 · 0 评论 -
UVa12107 - Digit Puzzle
题目大意是给你三个待定的字符串。形如7 * 8 。要求变换空格或者数字似的前一个字符串X后一个字符串=最后一个字符串有唯一解,且变换次数最少,多解时输出字典序最小的答案。规定空格的字典序小于数字。星号指代空格。 我有话说: 大致思想就是对每一位上的数字爆搜枚举,枚举完后并检验。这就要用到两个dfs。一个枚举数,一个检验。但在结构上都差不多。#include <iost原创 2015-07-21 07:47:05 · 1426 阅读 · 0 评论 -
UVa816 Abbott's Revenge
// UVa816 Abbott's Revenge// Rujia Liu#include<cstdio>#include<cstring>#include<vector>#include<queue>using namespace std;struct Node { int r, c, dir; // 站在(r,c),面朝方向dir(0~3分别表示N, E, S, W) No原创 2015-10-16 20:17:10 · 570 阅读 · 0 评论 -
1604 - Cubic Eight-Puzzle
我有话说: 这道题叫做立体八数码问题。但绝对比八数码问题要难得多。一个是状态数量增加,另外一个是状态的难以表示。这道题的基本思路是双向广搜+深搜;并且对广搜的步数有一个上限,正向21,反向9,是试验过最快的一种。#include <iostream>#include <algorithm>#include <cstdio>#include <cstring>#include原创 2015-10-20 20:27:13 · 567 阅读 · 0 评论 -
UVa307Sticks
George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had origi原创 2015-10-28 08:51:53 · 366 阅读 · 0 评论 -
12325 - Zombie's Treasure Chest
我有话说:开始是想写背包的,但是碍于数据范围,想到了枚举。 枚举物体1的个数,尽量装物体2,这个方法在V/S1较小是可行的。如果S1很小,那么就枚举物体2,但是当S2也很小的时候该怎么办? 注意到S2个物体1和S1个物体2所占的空间相同。但总价值有三种情况: 1.S2*V1>S1*V2;那么物体2最多只能装S1-1个。否则就可以转换成S2个物体一这是更优解。 2.S2*V1< S1*V2 类原创 2015-07-19 09:28:46 · 397 阅读 · 0 评论 -
## 八数码难题 ##
八数码难题http://codevs.cn/problem/1225/题目描述 Description Yours和zero在研究A*启发式算法.拿到一道经典的A*问题,但是他们不会做,请你帮他们. 问题描述在3×3的棋盘上,摆有八个棋子,每个棋子上标有1至8的某一数字。棋盘中留有一个空格,空格用0来表示。空格周围的棋子可以移到空格中。要求解的问题是:给出一种初始布局(初始状态)和目标布局(为了原创 2015-04-12 15:24:11 · 596 阅读 · 0 评论 -
补丁VS错误
补丁VS错误题目描述 Description 错误就是人们所说的Bug。用户在使用软件时总是希望其错误越少越好,最好是没有错误的。但是推出一个没有错误的软件几乎不可能,所以很多软件公司都在疯狂地发放补丁(有时这种补丁甚至是收费的)。T公司就是其中之一。上个月,T公司推出了一个新的字处理软件,随后发放了一批补丁。最近T公司发现其发放的补丁有致命的问题,那就是一个补丁在排除某些错误的同时,往往会加入另原创 2015-04-12 14:53:56 · 446 阅读 · 0 评论 -
靶形数独
靶形数独http://codevs.cn/problem/1174/ 题目描述 Description 小城和小华都是热爱数学的好学生,最近,他们不约而同地迷上了数独游戏,好胜的他 们想用数独来一比高低。但普通的数独对他们来说都过于简单了,于是他们向Z 博士请教, Z 博士拿出了他最近发明的“靶形数独”,作为这两个孩子比试的题目。 靶形数独的方格同普通数独一样,在 9 格宽×9 格高的大九原创 2015-04-12 15:07:24 · 747 阅读 · 0 评论 -
坏掉的项链
描述你有一条由N个红色的,白色的,或蓝色的珠子组成的项链(3<=N<=350),珠子是随意安排的。 这里是 n=29 的二个例子: 1 2 1 2 r b b r b r r b r b原创 2015-04-25 21:47:15 · 934 阅读 · 0 评论 -
线型网络
http://codevs.cn/problem/1344/ 题目描述 Description 有 N ( <=20 ) 台 PC 放在机房内,现在要求由你选定一台 PC,用共 N-1 条网线从这台机器开始一台接一台地依次连接他们,最后接到哪个以及连接的顺序也是由你选定的,为了节省材料,网线都拉直。求最少需要一次性购买多长的网线。(说白了,就是找出 N 的一个排列 P1 P2 P3 ..PN 然原创 2015-05-10 16:00:22 · 647 阅读 · 0 评论 -
UVa10603 - Fill
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=841&page=show_problem&problem=1544 终于UVa好了。所以要开始整理一下我在UVa上的题目了。 这个题库主要是因为《算法入门经典》的推荐。都是英文,网上又找不到翻译所以要用起来的话除非你是学霸。要不你有一本《算原创 2015-05-10 16:26:27 · 355 阅读 · 0 评论 -
线型网络
题目描述 Description 有 N ( <=20 ) 台 PC 放在机房内,现在要求由你选定一台 PC,用共 N-1 条网线从这台机器开始一台接一台地依次连接他们,最后接到哪个以及连接的顺序也是由你选定的,为了节省材料,网线都拉直。求最少需要一次性购买多长的网线。(说白了,就是找出 N 的一个排列 P1 P2 P3 ..PN 然后 P1 -> P2 -> P3 -> … -> PN 找出 |转载 2015-05-03 16:40:07 · 521 阅读 · 0 评论 -
11212 - Editing a Book
Problem EEditing a BookYou have n equal-length paragraphs numbered 1 to n. Now you want to arrange them in the order of 1, 2, …, n. With the help of a clipboard, you can easily do this: Ctrl-X (cut) an原创 2015-06-28 17:25:12 · 454 阅读 · 0 评论 -
欢迎使用CSDN-markdown编辑器
Bandwidth Given a graph (V,E) where V is a set of nodes and E is a set of arcs in VxV, and an ordering on the elements in V, then the bandwidth of a node v is defined as the maximum distance in the ord原创 2015-07-12 11:14:07 · 263 阅读 · 0 评论 -
1602 - Lattice Animals
Lattice animal is a set of connected sites on a lattice. Lattice animals on a square lattice are especially popular subject of study and are also known as polyominoes. Polyomino is usually represented原创 2015-07-12 19:36:09 · 544 阅读 · 0 评论 -
1603 - Square Destroyer
The left figure below shows a complete 3x3 grid made with 2x(3x4) (=24) matchsticks. The lengths of all matchsticks are one. You can find many squares of different sizes in the grid. The size of原创 2015-07-12 15:38:52 · 497 阅读 · 1 评论 -
文章标题
There is a mysterious planet called Yaen, whose space is 2-dimensional. There are many beautiful stones on the planet, and the Yaen people love to collect them. They bring the stones back home and make原创 2015-07-13 10:32:52 · 224 阅读 · 0 评论 -
1159:Maze
查看 提交 统计 提问 总时间限制: 2000ms 内存限制: 65536kB 描述 Acm, a treasure-explorer, is exploring again. This time he is in a special maze, in which there are some doors (at most 5 doors, represented by ‘A’, ‘B’, ‘原创 2015-10-30 15:28:52 · 1017 阅读 · 0 评论