A ring is composed of n (even number) circles as shown in diagram. Put natural numbers 1, 2, . . . , n into each circle separately, and the sum of numbers in two adjacent circles should be a prime. Note: the number of first circle should always be 1. >>继续阅读
与‘基础算法-搜索(DFS\BFS)\记忆化’有关的日志
uva10562
Professor Homer has been reported missing. We suspect that his recent research works might have had something to with this. But we really don’t know much about what he was working on! The detectives tried to hack into his computer, but after hours of >>继续阅读
uva816
The 1999 World Finals Contest included a problem based on a dice maze. At the time the problem was written, the judges were unable to discover the original source of the dice maze concept. Shortly after the contest, however, Mr. Robert Abbott, the cr >>继续阅读
uva1103
In order to understand early civilizations, archaeologists often study texts written in ancient languages. One such language, used in Egypt more than 3000 years ago, is based on characters called hieroglyphs. In this problem, you will write a program >>继续阅读
uva572
The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the land into numerous square plots. It then analyze >>继续阅读
poj1414
Life Line
Let's play a new board game "Life Line". The number of the players is greater than 1 and less than 10. In this game, the board is a regular triangle in which many small regular triangles are arranged (See Figure 1). The edges of each smal >>继续阅读
poj2718
Smallest Difference
Given a number of distinct decimal digits, you can form one integer by choosing a non-empty subset of these digits and writing them in some order. The remaining digits can be written down in some order to form a second integer. >>继续阅读
poj3187
Backward Digit Sums
FJ and his cows enjoy playing a mental game. They write down the numbers from 1 to N (1 <= N <= 10) in a certain order and then sum adjacent numbers to produce a new list with one fewer number. They repeat this until only >>继续阅读
poj1128
Frame Stacking
Consider the following 5 picture frames placed on an 9 x 8 array.Now place them on top of one another starting with 1 at the bottom and ending up with 5 on top. If any part of a frame covers another it hides that part of the frame be >>继续阅读
poj3279
Fliptile
Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 15) of square tiles, each of which is col >>继续阅读
hdu1495
非常可乐
大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 >>继续阅读
hdu2612
Find a way
Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home is at the countryside, but Merceki’s home is in the >>继续阅读
uva11624
Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze. Given Joe’s location in the maze and which squares of the maze are on fire, you >>继续阅读
fzu2150
Problem 2150 Fire Game
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. F >>继续阅读
poj3414
Pots
You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i): fill the poti (1 ≤ i ≤ 2) from the tap; DROP(i): empty the poti to the drain; POUR(i,j): pour from poti to pot j; aft >>继续阅读
poj3087
Shuffle'm Up
The actual shuffle operation is performed by interleaving a chip from S1 with a chip from S2 as shown below for C = 5:A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by st >>继续阅读