随笔分类 - 动态规划
摘要:DescriptionA square township has been divided up into n*m(n rows and m columns) square plots (1 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef long long LL; 7 8 const int MAXN = 12; 9 const int SIZEH = 13131; 10 const int MAXH = 20010; 11 12 struct hash_map { 13 i...
阅读全文
摘要:One day Greg and his friends were walking in the forest. Overall there werenpeople walking, including Greg. Soon he found himself in front of a river. The guys immediately decided to get across the river. Luckily, there was a boat by the river bank, just where the guys were standing. We know that th
阅读全文
摘要:DescriptionBackgroundRegardless of the fact, that Vologda could not get rights to hold the Winter Olympic games of 20**, it is well-known, that the ci...
阅读全文
摘要:Problem DescriptionMost of us know that in the game called DotA(Defense of the Ancient), Pudge is a strong hero in the first period of the game. When the game goes to end however, Pudge is not a strong hero any more.So Pudge’s teammates give him a new assignment—Eat the Trees!The trees are in a rect
阅读全文
摘要:Problem DescriptionA password locker with N digits, each digit can be rotated to 0-9 circularly.You can rotate 1-3 consecutive digits up or down in one step.For examples:567890 -> 567901 (by rotating the last 3 digits up)000000 -> 000900 (by rotating the 4th digit down)Given the current state
阅读全文
摘要:DescriptionLong long ago, there lived two rabbits Tom and Jerry in the forest. On a sunny afternoon, they planned to play a game with some stones. There were n stones on the ground and they were arranged as a clockwise ring. That is to say, the first stone was adjacent to the second stone and the n-
阅读全文
摘要:DescriptionN soldiers from the famous "*FFF* army" is standing in a line, from left to right. o o o o o o o o o o o o o o o o o o /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ ...
阅读全文
摘要:DescriptionIf we sum up every digit of a number and the result can be exactly divided by 10, we say this number is a good number. You are required to count the number of good numbers in the range from A to B, inclusive.InputThe first line has a number T (T 2 #include 3 #include 4 #include 5 usin...
阅读全文
摘要:DescriptionA tree with N nodes and N-1 edges is given. To connect or disconnect one edge, we need 1 unit of cost respectively. The nodes are labeled from 1 to N. Your job is to transform the tree to a cycle(without superfluous edges) using minimal cost.A cycle of n nodes is defined as follows: (1)a
阅读全文
摘要:DescriptionPlain of despair was once an ancient battlefield where those brave spirits had rested in peace for thousands of years. Actually no one dare step into this sacred land until the rumor that “there is a huge gold mine underneath the plain” started to spread.Recently an accident destroyed the
阅读全文
摘要:DescriptionCould you imaging a monkey writing computer programs? Surely monkeys are smart among animals. But their limited intelligence is no match for our human beings. However, there is a theorem about monkeys, and it states that monkeys can write everything if given enough time. The theorem is ca
阅读全文
摘要:Description“Farm Game” is one of the most popular games in online community. In the community each player has a virtual farm. The farmer can decide to plant some kinds of crops like wheat or paddy, and buy the corresponding crop seeds. After they grow up, The farmer can harvest the crops and sell th
阅读全文
摘要:DescriptionLamps-O-Matic company assembles very large chandeliers. A chandelier consists of multiple levels. On the first level crystal pendants are a...
阅读全文
摘要:DescriptionThere is a famous joke-riddle for children:Three turtles are crawling along a road. One turtle says: "There are two turtles ahead of me." The other turtle says: "There are two turtles behind me." The third turtle says: "There are two turtles ahead of me and two tu
阅读全文
摘要:DescriptionA plotter is a vector graphics printing device that connects to a computer to print graphical plots. There are two types of plotters: pen p...
阅读全文
摘要:A and B are playing a shooting game on a battlefield consisting of square-shaped unit blocks. The blocks are occupying some consecutive columns, and the perimeter of the figure equals the perimeter of its minimal bounding box. The figure (a) below is a valid battlefield, but (b) and (c) are not, bec
阅读全文
摘要:Problem Description Bob gets tired of playing games, leaves Alice, and travels to Changsha alone. Yuelu Mountain, Orange Island, Window of the World, the Provincial Museum etc...are scenic spots Bob wants to visit. However, his time is very limited, he can’t visit them all. Assuming that there are..
阅读全文
摘要:Problem Description One day, a hunter named James went to a mysterious area to find the treasures. James wanted to research the area and brought all treasures that he could. The area can be represented as a N*M rectangle. Any points of the rectangle is a number means the cost of research it,-1 mea..
阅读全文
摘要:DescriptionFacer is addicted to a game called "Tidy is learning to swim". But he finds it too easy. So he develops a new game called "Facer is learning to swim" which is more difficult and more interesting.In the new game, a robot named "Facer" is swimming in a pool. Th
阅读全文
摘要:DescriptionPanagola, The Lord of city F likes to parade very much. He always inspects his city in his car and enjoys the welcome of his citizens. City...
阅读全文

浙公网安备 33010602011771号