摘要: Problem DescriptionFew know that the cows have their own dictionary with W (1 ≤ W ≤ 600) words, each containing no more 25 of the characters 'a'..'z'. Their cowmunication system, based on mooing, is not very accurate; sometimes they hear words that do not make any sense. For instance 阅读全文
posted @ 2013-08-09 10:11 persistent codeants 阅读(288) 评论(0) 推荐(0)
摘要: 1523. K-inversionsTime limit: 1.0 second Memory limit: 64 MBConsider a permutationa1,a2, …,an(allaiare different integers in range from 1 ton). Let us callk-inversiona sequence of numbersi1,i2, …,iksuch that 1≤i1ai2>…>aik. Your task is to evaluate the number of differentk-inversions in a given 阅读全文
posted @ 2013-08-09 08:10 persistent codeants 阅读(209) 评论(0) 推荐(0)
摘要: 1350. CanteenTime limit: 1.0 second Memory limit: 64 MBIt’s dangerous to eat in a canteen — you may be poisoned by a not fresh food. One may fall into a coma because of the canteen’s chicken and the other feels OK. And vice versa. The food is cooked fromMdifferent food stuffs. There areNdifferent fo 阅读全文
posted @ 2013-08-08 17:51 persistent codeants 阅读(249) 评论(0) 推荐(0)
摘要: Problem DescriptionThe cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-pin-like triangle like this: 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5Then the other cows ... 阅读全文
posted @ 2013-08-08 16:38 persistent codeants 阅读(200) 评论(0) 推荐(0)
摘要: Problem DescriptionGigel 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 are attached to these arms and Gigel wants to hang up some weigh 阅读全文
posted @ 2013-08-08 16:06 persistent codeants 阅读(237) 评论(0) 推荐(0)
摘要: DescriptionBessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 int map[1000][1000]; 9 int bmask[1000];10 int ny,nx;11 int cy[1000],cx[1000];12 int n,k,a,b;13 int xm. 阅读全文
posted @ 2013-08-08 11:10 persistent codeants 阅读(229) 评论(0) 推荐(0)
摘要: In 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; it is true that the soldiers are aligned in order by their code number: 1 , 2 , 3 阅读全文
posted @ 2013-08-07 21:31 persistent codeants 阅读(202) 评论(0) 推荐(0)
摘要: 1080. Map ColoringTime limit: 1.0 second Memory limit: 64 MBWe consider a geographical map withNcountries numbered from 1 toN(0 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 using namespace std;12 int pay[105];13 queueQ;14 int map[105][105];15 i 阅读全文
posted @ 2013-08-07 18:08 persistent codeants 阅读(390) 评论(0) 推荐(0)
摘要: 1242. WerewolfTime limit: 1.0 second Memory limit: 64 MBKnife. Moonlit night. Rotten stump with a short black-handled knife in it. Those who know will understand. Disaster in the village. Werewolf.There are no so many residents in the village. Many of them are each other's relatives. Only this m 阅读全文
posted @ 2013-08-07 15:51 persistent codeants 阅读(413) 评论(0) 推荐(0)
摘要: 1033. LabyrinthTime limit: 1.0 second Memory limit: 64 MBAdministration of the labyrinth has decided to start a new season with new wallpapers. For this purpose they need a program to calculate the square of the walls inside the labyrinth. This job is just for you!The labyrinth is represented by a m 阅读全文
posted @ 2013-08-07 13:24 persistent codeants 阅读(291) 评论(0) 推荐(0)