Play on Words(有向图欧拉路)
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:8571Accepted:2997DescriptionSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very important for us.There
阅读全文
posted @
2013-08-30 16:51
straw_berry
阅读(225)
推荐(0)
Human Gene Functions
摘要:http://poj.org/problem?id=1080题意:已知一个人类基因的积分表,给出两个字符串,计算这两个串的最大相似程度;思路:最长公共子序列的变形,用score[][] 表示积分值,dp[i][j]表示字符串s1[1,2,,,i]和s2[1,2,,,j]的分值,对一个dp[i][j],有三种可能:> s1取第i个字符,s2取‘-’时,dp[i][j] = dp[i-1][j] + score[s1[i]][0];>s1取‘-’,s2取第j个字符时,dp[i][j] = dp[i][j-1] + score[0][s2[j]];>s1取第i个字符,s2取第j个字
阅读全文
posted @
2013-08-30 15:30
straw_berry
阅读(330)
推荐(0)
Palindrome(最长公共子序列)
摘要:Time Limit:3000MSMemory Limit:65536KTotal Submissions:48526Accepted:16674DescriptionA palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the minimal number of characters
阅读全文
posted @
2013-08-30 09:37
straw_berry
阅读(246)
推荐(0)
A Simple problem
摘要:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2497题意:给出顶点数,边数及节点s,判断s是否包含在所有的环中;思路:并查集的应用,在除s节点以外的节点中,取出有公共源点的节点放到一个集合中,若还能形成环说明s不能经过所有的环,否则s能经过所有的环; 1 #include 2 #include 3 4 int set[10010],n,m,s; 5 6 int find(int x) 7 { 8 if(set[x] != x) 9 set[x] = find(set[x...
阅读全文
posted @
2013-08-29 23:23
straw_berry
阅读(197)
推荐(0)
Alignment ( 最长上升(下降)子序列 )
摘要:Time Limit:1000MSMemory Limit:30000KTotal Submissions:11397Accepted:3630DescriptionIn the army, a platoon is composed by n soldiers. During the morning inspection, the soldiers are aligned in a straight line in front of the captain. The captain is not satisfied with the way his soldiers are aligned;
阅读全文
posted @
2013-08-28 16:22
straw_berry
阅读(275)
推荐(0)
Balance(01背包)
摘要:Time Limit:1000MSMemory Limit:30000KTotal Submissions:9163Accepted:5617DescriptionGigel has a strange "balance" and he wants to poise it. Actually, the device is different from any other ordinary balance.It orders two arms of negligible weight and each arm's length is 15. Some hooks ar
阅读全文
posted @
2013-08-23 21:22
straw_berry
阅读(226)
推荐(0)
Cash Machine(多重背包)
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:24067Accepted:8414DescriptionA Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bill denominations, say Dk, k=1,N, and for eac
阅读全文
posted @
2013-08-23 12:48
straw_berry
阅读(333)
推荐(0)
Shredding Company(dfs)
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:3519Accepted:2009DescriptionYou have just been put in charge of developing a new shredder for the Shredding Company Although a "normal" shredder would just shred sheets of paper into little pieces so that the contents would become unrea
阅读全文
posted @
2013-08-22 20:54
straw_berry
阅读(257)
推荐(0)
Curling 2.0(dfs)
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:8795Accepted:3692DescriptionOn Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is marked. They use only
阅读全文
posted @
2013-08-22 10:59
straw_berry
阅读(226)
推荐(0)
Channel Allocation(四色定理 dfs)
摘要:Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 10897Accepted: 5594DescriptionWhen a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a strong signal. However, the channels used by each repeater must be carefully ch
阅读全文
posted @
2013-08-21 23:11
straw_berry
阅读(322)
推荐(0)
Sudoku(回溯)
摘要:Time Limit:2000MSMemory Limit:65536KTotal Submissions:12075Accepted:6026Special JudgeDescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. The other ce
阅读全文
posted @
2013-08-21 16:45
straw_berry
阅读(205)
推荐(0)
Pots(bfs)
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:8266Accepted:3507Special JudgeDescriptionYou are given two pots, having the volume ofAandBliters respectively. The following operations can be performed:FILL(i) fill the poti(1 ≤i≤ 2) from the tap;DROP(i) empty the potito the drain;POUR(i,j) pour
阅读全文
posted @
2013-08-20 20:39
straw_berry
阅读(279)
推荐(0)
Prime Path(素数筛选+bfs)
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:9519Accepted:5458DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.— It is a matter of security to change suc
阅读全文
posted @
2013-08-20 10:29
straw_berry
阅读(276)
推荐(0)
A Knight's Journey(dfs)
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:25950Accepted:8853DescriptionBackgroundThe knight is getting bored of seeing the same black and white squares again and again and has decided to make a journeyaround the world. Whenever a knight moves, it is two squares in one direction and one s
阅读全文
posted @
2013-08-19 20:27
straw_berry
阅读(270)
推荐(0)
Colored Sticks (字典树哈希+并查集+欧拉路)
摘要:Time Limit:5000MSMemory Limit:128000KTotal Submissions:27704Accepted:7336DescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the endpoints that touch are of the same c
阅读全文
posted @
2013-08-16 20:07
straw_berry
阅读(550)
推荐(0)
Squares(哈希)
摘要:Time Limit:3500MSMemory Limit:65536KTotal Submissions:14328Accepted:5393DescriptionA square is a 4-sided polygon whose sides have equal length and adjacent sides form 90-degree angles. It is also a polygon such that rotating about its centre by 90 degrees gives the same polygon. It is not the only p
阅读全文
posted @
2013-08-16 10:40
straw_berry
阅读(320)
推荐(0)
Gold Balanced Lineup(哈希表)
摘要:Time Limit:2000MSMemory Limit:65536KTotal Submissions:10711Accepted:3182DescriptionFarmer John'sNcows (1 ≤N≤ 100,000) share many similarities. In fact, FJ has been able to narrow down the list of features shared by his cows to a list of onlyKdifferent features (1 ≤K≤ 30). For example, cows exhib
阅读全文
posted @
2013-08-15 20:20
straw_berry
阅读(286)
推荐(0)
Snowflake Snow Snowflakes(哈希,大素数取模)
摘要:Time Limit:4000MSMemory Limit:65536KTotal Submissions:27277Accepted:7197DescriptionYou may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a collection of snowflakes, and search for a pair
阅读全文
posted @
2013-08-15 09:43
straw_berry
阅读(415)
推荐(0)
Eqs (哈希)
摘要:Time Limit:5000MSMemory Limit:65536KTotal Submissions:10695Accepted:5185DescriptionConsider equations having the following form:a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0The coefficients are given integers from the interval [-50,50].It is consider a solution a system (x1, x2, x3, x4, x5) that verifies the
阅读全文
posted @
2013-08-14 16:01
straw_berry
阅读(244)
推荐(0)
Blue Jeans(串)
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:10083Accepted:4262DescriptionThe Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map how the Earth was populated.As an IBM researche
阅读全文
posted @
2013-08-14 09:25
straw_berry
阅读(173)
推荐(0)
Finding Nemo(bfs)
摘要:Time Limit:2000MSMemory Limit:30000KTotal Submissions:6988Accepted:1600DescriptionNemo is a naughty boy. One day he went into the deep sea all by himself. Unfortunately, he became lost and couldn't find his way home. Therefore, he sent a signal to his father, Marlin, to ask for help.After checki
阅读全文
posted @
2013-08-13 14:17
straw_berry
阅读(330)
推荐(0)
Ultra-QuickSort(归并排序求逆序对数)
摘要:Time Limit:7000MSMemory Limit:65536KTotal Submissions:34283Accepted:12295DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending orde
阅读全文
posted @
2013-08-13 08:49
straw_berry
阅读(204)
推荐(0)
Power Network (最大流增广路算法模板题)
摘要:Time Limit:2000MSMemory Limit:32768KTotal Submissions:20754Accepted:10872DescriptionA power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of power, may produce an amount 0 2 #include 3 #i
阅读全文
posted @
2013-08-12 16:55
straw_berry
阅读(246)
推荐(0)
Sorting It All Out
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:24354Accepted:8417DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A, B, C, D implies that A 2 #.
阅读全文
posted @
2013-08-09 17:02
straw_berry
阅读(163)
推荐(0)
Asteroids(二分图最大匹配模板题)
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:12323Accepted:6716DescriptionBessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 2 #include 3 int map[510][510]; 4 int link[510]; 5 int vis[510]; 6 int n; 7 bool dfs(int u) 8 { 9 int v;1...
阅读全文
posted @
2013-08-08 21:23
straw_berry
阅读(258)
推荐(0)
昂贵的聘礼
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:32063Accepted:9080Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其他的东西,他可以降低价格
阅读全文
posted @
2013-08-08 19:17
straw_berry
阅读(334)
推荐(0)
Borg Maze(bfs+prim)
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:6971Accepted:2345DescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilization. Each Borg individua
阅读全文
posted @
2013-08-08 16:02
straw_berry
阅读(207)
推荐(0)
Currency Exchange(判断是否有正环)
摘要:Time Limit:1000MSMemory Limit:30000KTotal Submissions:16456Accepted:5732DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There can be several point
阅读全文
posted @
2013-08-07 15:57
straw_berry
阅读(284)
推荐(0)
Children of the Candy Corn (bfs+dfs)
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:8120Accepted:3547DescriptionThe cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze facing zombies, chainsaw-wielding psychopaths, hippies, and other terrors on their quest to find the exi
阅读全文
posted @
2013-08-07 10:37
straw_berry
阅读(212)
推荐(1)
Tautology
摘要:DescriptionWFF 'N PROOF is a logic game played with dice. Each die has six faces representing some subset of the possible symbols K, A, N, C, E, p, q, r, s, t. A Well-formed formula (WFF) is any string of these symbols obeying the following rules:p, q, r, s, and t are WFFsifwis a WFF, Nwis a WFF
阅读全文
posted @
2013-08-06 14:55
straw_berry
阅读(318)
推荐(0)
Flip Game
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:25302Accepted:10918DescriptionFlip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying either it's black or white
阅读全文
posted @
2013-08-03 10:53
straw_berry
阅读(226)
推荐(0)
Radar Installation 贪心
摘要:Language:Radar InstallationTime Limit:1000MSMemory Limit:10000KTotal Submissions:42461Accepted:9409DescriptionAssume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locati
阅读全文
posted @
2013-08-02 14:46
straw_berry
阅读(177)
推荐(0)