- 博客(29)
- 资源 (2)
- 收藏
- 关注
原创 HDU_1272_小希的迷宫
HDU 1272 小希的迷宫 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的设计图是否符合她的设计思路。比如下面的例子,前两个是符合条件的,但是最后一个却有两
2016-10-30 16:34:12 312
原创 HDU_1232_畅通工程
HDU 1232 畅通工程 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?
2016-10-30 16:28:53 303
原创 DFS&BFS小结
DFS(depth first search):深度优先搜索,即一种有一定策略的枚举 核心:递归 特点: 1. 一搜到底,不通则返 2. 平等遍历,只看方向 3. 只求可行,不求最优 4. 效率过低 DFS伪代码: depthFirstSearch(v) { Label vertex v as reached. for(
2016-10-23 21:18:50 393
原创 HDU_1240_Asteroids!
HDU 1240 Asteroids! You're in space.You want to get home.There are asteroids.You don't want to hit them.
2016-10-23 20:48:23 365
原创 HDU_2717_Catch That Cow
HDU 2717 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
2016-10-23 20:43:48 258
原创 POJ_1915_Knight Moves
POJ 1915 Knight Moves Background Mr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him?
2016-10-23 20:38:09 261
原创 HDU_1518_Square
HDU 1518 Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square?
2016-10-23 20:23:50 279
原创 HDU_1010_Tempter of the Bone
HDU 1010 The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone
2016-10-23 20:18:40 420
原创 HDU_5339_Untitled
HDU 5339 There is an integer a and n integers b1,…,bn. After selecting some numbers from b1,…,bn in any order, say c1,…,cr, we want to make sure that a mod c1 mod c2 mod… mod cr=0 (i.e., a will become the remai
2016-10-23 19:58:36 361
原创 POJ_2386_Lake Counting
POJ 2386 Due 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 square contains either water
2016-10-23 16:32:38 338
原创 HDU_5167_Fibonacci
HDU 5167 Following is the recursive definition of Fibonacci sequence:Fi=01Fi−1+Fi−2i = 0i = 1i > 1Now we need to check whether a number can be expressed as the product of numbe
2016-10-23 16:26:30 328
原创 POJ_1979_Red and Black
POJ 1979 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 tiles. But he c
2016-10-23 16:18:05 424
原创 STL小结
C++中STL是非常有利的工具,善用这些工具,不管是再ACM竞赛或者是项目开发中都有着非常简洁方便的作用。C++官网,任何用法都可以在此查询STL中内容丰富庞杂,要熟知每个用法着实困难,其实也无需全都知道,只要知道有那么一个工具用的时候去上面地网站查一下便知,但对于一些基本的容器必须要熟记其用法。 容器用法向量(vector) :连续存储的元素<vector>列表(
2016-10-16 23:28:47 375 2
原创 HDU_4585_Shaolin
HDU_4585_Shaolin 题意:少林寺招新,起初只有一个id为1武力值为1000000000的老和尚,现在要招一些新和尚,每个和尚入寺考核要和已经入寺的和尚比武且只和武力值与他相差最小的比武,当有两个和尚与他武力值差值相同时(比如大1和小1)便在这些差值相同的和尚里只和比他小的比武。 思路:用STL中的映射,用武力值作为键,然后找已入寺的和尚比武时用lower_bound
2016-10-16 23:02:28 776
原创 UVA_Rails
UVA Rails There is a famous railway station in PopPush City. Country there is incredibly hilly. The stationwas built in last century. Unfortunately, funds were extremely limited that time. It was possible to
2016-10-16 22:29:34 445
原创 POJ_1256_Anagram
POJ_1256_Anagram You are to write a program that has to generate all possible words from a given set of letters. Example: Given the word "abc", your program should - by exploring all different combination of
2016-10-16 22:13:41 292
原创 HDU_4022_Bombing
HDU_5022_Bombing It’s a cruel war which killed millions of people and ruined series of cities. In order to stop it, let’s bomb the opponent’s base. It seems not to be a hard work in circumstances of street
2016-10-16 22:07:29 432
原创 HDU_1263_水果
HDU_1263_水果思路 STL 夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了.
2016-10-16 21:42:29 466
原创 二分三分小结
**二分三分小结** 在ACM程序竞赛中,经常要用到二分的方法来求值,因为二分的复杂度是lgn,比直接for循环枚举所有可能高效得多,但用二分时往往是单调函数的情况,如查找一个数组中的某个值,要先将该数组排序。不同的题目二分往往有不同的形式,但其本质都是相同的,只不过不同的问题里要求不同。 简单定义:在一个单调有序的集合中查找元素,每次将集合分为左右两部分,判断解在哪个部分中并调整集合上下界
2016-10-06 21:14:10 399
原创 UVA_714_Copying Books
UVA 714 Copying Books Before the invention of book-printing, it was very hard to make a copy of a book. All the contents hadto be re-written by hand by so called scribers. The scriber had been given a book an
2016-10-06 20:23:06 322
原创 ZOJ_3203_Light Bulb
ZOJ 3203 Light Bulb Compared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow and he has only one light bulb in his house. Every night, he is wandering in his incommodio
2016-10-06 20:05:57 637
原创 HDU_1969_Pie
HDU 1969 Pie My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each
2016-10-06 19:48:09 358
原创 CodeForces 371C Hamburgers
CodeForces 371C HamburgersPolycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make
2016-10-06 19:37:36 415
原创 HDU_2899_Strange fuction
HDU 2899 Strange functionNow, here is a fuction: F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100)Can you find the minimum value when x is between 0 and 100.
2016-10-06 19:23:07 416
原创 HDU_2141_Can you find it?
HDU 2141 Can you find it? Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+Ck = X
2016-10-04 23:17:31 394
原创 POJ_1905_Expanding Rods
POJ 1905 二分 When a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coefficient of heat expansion. When a thin rod is mounted on two solid walls and then heate
2016-10-04 20:05:04 397
原创 POJ_3518_Prime Gap
POJ 3518 The sequence of n − 1 consecutive composite numbers (positive integers that are not prime and not equal to 1) lying between two successive prime numbers p and p + n is called a prime gap of length n.
2016-10-04 18:53:24 608
原创 POJ_3273_Monthly Expense
poj 3273 Monthly Expense Farmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤ moneyi
2016-10-01 03:17:18 427
原创 POJ_1434_Fill the Cisterns!
Fill the Cisterns! Time Limit: 5000M Memory Limit: 10000K Total Submissions: 4016 Accepted: 1331DescriptionDuring the next century cer
2016-10-01 03:08:20 427
OpenGL在CodeBlocks下的glut配置文件
2017-10-20
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人