Eight Questions of Poj1737~poj1744--ltc man

Source: Internet
Author: User
Tags number strings

Ready to brush this mystery of the eight questions, although I am not a man ...

Degree of Completion: 3/8

2016.7.~? poj1742 Coins

Test instructions: give you n denominations of coins and the number of each coin. Find out how many of these coins can be used in 1~m.

Algorithm: DP

Resolution: Dp[i][j] Indicates the number of coins remaining in the first I coin (if not composed of J, 1).

Consider the following four scenarios:

(1) If dp[i-1][j]>=0, there is no need for the first coins, C[i]

(2) If val[i]>j, face value is too large, then 1

(3) If dp[i][j-val[i]]<=0, cannot form J, then 1

(4) if (1) (2) (3) are not satisfied, for dp[i][j-val[i]]-1

In addition, this problem n*m larger, because dp[i][] only with dp[i-1][], so with a scrolling array can

2016.8.30 poj1743 Musical Theme

Test instructions: give you a bunch of numbers, the largest number of discontinuous substring string length, if ans<5, then output-1. Two number strings similar when and only if, one number of strings plus the same number equals another string.

Algorithm: suffix array

Parsing://More than 10 days ago Brush suffix Array entry question, now somewhat blurred = =

First of all, the number of strings into the next two number of differences in the form, and then height[] classification, with h[i]>=h[i-1]-1 formula.

Time Complexity of O (N*LOGN)

2016.9.11 poj1740 A New Stone Game

Test instructions: There are n heap of stones, each time each person from one of the piles to take away a number of stones, the stones are allocated to other heaps (not all of them), can not be taken to lose. A after B, ask a the winning and losing situation.

Algorithm: Game theory

Analysis: According to the symmetry, if the stone 22 pairs, then the winner wins, otherwise, the first to win.

Proof: If the number of heaps is odd, the stones are sorted from small to large, and (3,4) ... Paired. Take the heap of the most stones and assign the stones to the 1,3,5 ... The heap. If the number of heaps is even, the heap that takes the most stones makes the number of pebbles equal to the minimum heap and does the same.

Eight Questions of Poj1737~poj1744--ltc man

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.