随笔分类 -  1.poj

摘要: N (2 <= N <= 8,000) cows have unique brands in the range 1..N. In a spectacular display of poor judgment, they visited the neighborhood 'watering hole' and drank a few too many beers before dinner. When it was time to line up for their evening meal, they did not line up in the required ascending numerical order of their brands. 阅读全文
posted @ 2016-12-06 21:31 ZegWe 阅读(593) 评论(0) 推荐(0)
摘要: Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on, for all of his paper was filled with squares and rectangles), he dreamt of filling a large rectangle with small rectangles of width 2 and height 1 in var 阅读全文
posted @ 2016-11-02 22:04 ZegWe 阅读(191) 评论(0) 推荐(0)
摘要:A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers. Write a program to find and print the nth element in this sequence. 阅读全文
posted @ 2016-11-02 18:11 ZegWe 阅读(415) 评论(0) 推荐(0)
摘要:Given an integer sequence { an } of length N, you are to cut the sequence into several parts every one of which is a consecutive subsequence of the original sequence. Every part must satisfy that the sum of the integers in the part is not greater than a given integer M. You are to find a cutting that minimizes the su 阅读全文
posted @ 2016-10-25 22:03 ZegWe 阅读(964) 评论(0) 推荐(1)
摘要:These days, Sempr is crazed on one problem named Crazy Thair. Given N (1 ≤ N ≤ 50000) numbers, which are no more than 109, Crazy Thair is a group of 5 numbers {i, j, k, l, m} satisfying: 1. 1 ≤ i < j < k < l < m ≤ N 2. Ai < Aj < A 阅读全文
posted @ 2016-10-24 18:29 ZegWe 阅读(241) 评论(0) 推荐(0)
摘要:Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem. There is a very long board with length L centimeter, L is a positive integer, so we can evenly divide the board into L segments, and they are labeled by 1, 2, ... L from left to right, each is 1 c 阅读全文
posted @ 2016-10-23 20:18 ZegWe 阅读(416) 评论(0) 推荐(0)
摘要:Railway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue… The Lunar New Year was approaching, but unluckily the Little Cat still had schedules going here and there. Now, he had to travel by train to Mianyang, Sichuan Province for the winter camp selection of the national team of Olympiad in Informatics. It was one o’clock a.m. and dark out 阅读全文
posted @ 2016-10-23 16:26 ZegWe 阅读(468) 评论(0) 推荐(0)
摘要:The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally decided to build an electoral wall for placing the posters and introduce the following rules: Every candidate can place exactly one poster on the wall. All posters are of the 阅读全文
posted @ 2016-10-21 18:05 ZegWe 阅读(228) 评论(0) 推荐(0)
摘要:You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quickly k-th order statistics in the array segment. 阅读全文
posted @ 2016-10-16 20:39 ZegWe 阅读(268) 评论(0) 推荐(0)