武大OJ 574. K-th smallest】的更多相关文章

Description Give you a number S of length n,you can choose a position and remove the number on it.After that,you will get a new number. More formally,you choose a number x(1<=x<=n),then you will get the number Rx=S1S2…..Sx-1 Sx+1……Sn..The problem is…
Problem K: 负2进制 Time Limit: 2 Sec Memory Limit: 128 MB Submit: 51 Solved: 6 [Submit][Status][Web Board] Description 如果我16岁,我可以悄悄的说我好喜欢你:如果我26岁,我可以大声告诉你我很爱你:可惜我6岁,我什么都给不了你,我还要上小学. 我们都知道2进制,每一位的权值如下: 1 2 4 8 16 32 64 现在我们定义一种-2进制,每一位的权值如下: 1 -2 4 -8 16…
Farmer John has a farm. Betsy, a famous cow, loves running in farmer John's land. The noise she made makes John mad. So he wants to restrict the area Betsy can run. There are nn (4<n\le 20000004<n≤2000000) points of interest (or POI) on the farm, th…
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ struct helper { ListNode *head; int len; helper(ListNode *h, int l) : head ( h ), len ( l ) {} }; class helper…
Description          Cyy likes something symmetrical, and Han Move likes something circular. Han Move gave you a circular string whose length is N, i.e. the i-th character of the string is the neighbor of the ( (i-1) mod N )-th character and ( (i+1)…
Description Today, the math teacher taught Alice Hui Yang’s triangle. However, the teacher came up with a new one, called Sama’s triangle (some of you may be familiar with this name).        In this triangle, there is only 30 row, and the ith row has…
Description Old Sama is a great and powerful magician in the word. One day, a little girl, Anny, touched Sama’s crystal and broke into his magic 2D space. However, Sama is very amiable. So he wanted to send Anny back to the real world instead of trap…
A sorted list A contains 1, plus some number of primes.  Then, for every p < q in the list, we consider the fraction p/q. What is the K-th smallest fraction considered?  Return your answer as an array of ints, where answer[0] = pand answer[1] = q. Ex…
A sorted list A contains 1, plus some number of primes.  Then, for every p < q in the list, we consider the fraction p/q. What is the K-th smallest fraction considered?  Return your answer as an array of ints, where answer[0] = pand answer[1] = q. Ex…
A sorted list A contains 1, plus some number of primes.  Then, for every p < q in the list, we consider the fraction p/q. What is the K-th smallest fraction considered?  Return your answer as an array of ints, where answer[0] = p and answer[1] = q. E…