250 points:Give some rules and ask where parking is allowed on the street.
Simply simulate the question and check whether each rule is valid.
Code: streetparking
500 points:Implements the intersection of sets and the difference operation.
Intersection operation: put an array into the set, traverse another array, and check whether each element is in the first set.
Operation: traverses two arrays and puts each element in the two arrays into the set.
Difference calculation: traverse two arrays to check whether the elements in one array do not exist in another array. If they do not exist, they are placed in the final set.
Because the question must be output incrementally, The treeset is used.
Code: Sets
1000 points:Specify a sequence, such as {39,88, 67,5, 69,87, 82,64, 58,61}, to find the longest length of the ascending subsequence (non-consecutive ), and find the number of sub-sequences with such a long increment.
Dynamic Planning, DP [I] = max {DP [J]} (j =, 2 ..., i-1 & Prices [J] <= Prices [I]} + 1; if such J does not exist, DP [I] = 1; that is, find the element that is smaller than prices [I] and has the longest child sequence, and connect Prices [I] to form a new sequence.
Because the maximum number of incrementing subsequences is calculated, data such as {,} appears, the eldest son sequence is 29 31 34 53 86 and 5 6 34 53 86, both of which end with 86, therefore, the length of the sub-sequence that ends with I is always [I] = ways [J] + 1. J is described above.
Code: thepriceisright
[Topcoder] srm159 div2 Summary