Ultraviolet A 10306 e-coins

Uva_10306 You can simply recursively convert X and Y from small to large, and try M vector addition operations for each grid. # Include # Include String . H> # Define Maxm 50 # Define # Maxs 310 # Define INF 1000000000 Int M, S, X [maxm], Y

Ultraviolet A 116 unidirectional TSP

Uva_116 This topic can be implemented by means of Memory search. Because the numbers in the matrix are not all positive, INF can be used as a marker that has not been searched. The minimum Lexicographic Order is required, so you can control the

Ultraviolet A 437 the tower of Babylon

Uva_437 First, you can change a cube to three for storage. Then, you can sort the cubes in ascending order of the bottom area and find the longest ascending subsequence. # Include # Include String . H># Include # Define Maxd 110 Int N, F [maxd],

Ultraviolet A 106 Fermat vs. Pythagoras

Uva_106 Continue to accumulate mathematical knowledge. The formula A = m ^ 2-N ^ 2, B = 2 * m * n, c = m ^ 2 + N ^ 2 is required for this question, by enumerating M and N, you can obtain the number of all the shares of # Include # Include

Spoj 9939 eliminate the con communications ICT

Spoj_9939 This question can be done using 2-sat. First of all, we need to find the core variable because it is a 2-SAT problem. However, the choice of B is three for each board, stone (1) and scissors (2), cloth (3), is it 3-Sat? Joke. At least

Ultraviolet A 10201 adventures in moving-Part IV

Uva_10201 We may use F [I] [J] to indicate the minimum cost required for this state when the fuel volume at the I gas station is J, so first of all, some of the states are inherited from the first gas station in I-1, that is, F [I] [J] = f [I-1]

Ultraviolet A 531 compromise

Uva_531 In essence, it is still a problem of finding the longest common subsequence, but it only needs to print the path. # Include # Include String . H> # Define Maxn 110 # Define Maxm 40 Char A [maxn] [maxm], A, B [maxn] [maxm], B; Int F [maxn]

Va 10673 play with floor and ceil

Uva_000073 This question can be used to expand EuclideanAlgorithmReturns a group of integers, but can be directly constructed. We know that the difference between rounded up and rounded down can only be 0 or 1. If it is 1, we can obviously find

Ultraviolet A 825 walking on the safe side

Uva_825 A relatively easy counting problem, if (I, j) f [I] [J] = f [I-1] [J] + F [I] [J-1], otherwise f [I] [J] = 0. # Include # Include String . H># Include # Define Maxd 1010 Char B [ 10010 ]; Int N, m, G [maxd] [maxd], F [maxd] [maxd]; Void

Apsaravideo player 624 CD

Uva_624 Actually it is the problem of the 0-1 backpack. It is enough to convert the time into the volume and value. Note that the dimension of the total time needs to be larger, and 10000 is enough. # Include # Include String . H> # Define Maxn 3

Sgu 103 traffic lights

Sgu_103 Different from the general most short-circuit problem, we must first determine when we can embark on a certain path, therefore, we need to calculate the recent time when two lights have changed to the same color from the current moment. Of

Va 590 always on the run

Uva_590 Based on the arrival time, we can regard the graph as a K-layer, and then use spfa to find the shortest path of each point. # Include # Include String . H> # Define INF 1000000000 Int N, K, G [ 15 ] [ 15 ] [ 40 ], T [ 15 ] [ 15 ], F [15 ]

Ultraviolet A 348 optimal array multiplication Sequence

Uva_348 This is a question about interval dynamic planning, the dynamic transition equation is f [I] [J] = min {f [I] [k] + F [k + 1] [J] + left [I] * right [K]. * Right [J]}. # Include # Include String . H> # Define Maxd 20 # Define INF 10000000

Ultraviolet A 709 Formatting Text

UVA_709 We may use f [I] to represent the smallest badness from a row to the end of the word I, so f [I] = min {f [I-1] + 500, f [j] + badness}. Of course, the words j + 1 to I must be in this line. Next, we may consider how to optimize the word

UV 10313 Pay the Price

UVA_10313 After reading RoBa's question, I finally realized it. This topic involves a conclusion that the number of solutions to generate I with no more than j coins is the same as the number of solutions to generate I with a coin with no more than

Ultraviolet A 10717 Mint

Uva_000017 Enumerate the choice of the table leg, and then calculate and update the smallest public multiple. #include#include#define MAXN 60#define MAXT 15int N, T, a[MAXN], t[MAXT];long long int low[MAXT], high[MAXT];long long int gcd(long long

Ultraviolet A 10280 Old Wine Into New Bottles

UVA_10280 I didn't expect this question to pass through a pruning and a dp with a high level of complexity. Of course, the complexity of this question is still quite troublesome if I calculate it carefully, I also mentioned several ideas later.

Ultraviolet A 571 Jugs

UVA_571 There was no idea at first, and later I came to the others' report and found that they were done in a greedy way. Because this question does not limit the number of times of pouring water, we only need to construct A feasible solution. If we

Ultraviolet A 11151 Longest Palindrome

UVA_11151 The equation of state transition is: ① B [I] = B [j], f [I] [j] = f [I + 1] [J-1] + (I = j? ); ② B [I]! = B [j], f [I] [j] = max {f [I + 1] [j], f [I] [J-1]}. # Include # Include # Define MAXD 1010Int N, f [MAXD] [MAXD];Char B

Ultraviolet A 11029 Leading and Trailing

UVA_11029 The last three digits of a two-digit multiplication are naturally determined by the last three digits. Therefore, we can use the fast idempotent Modulo for the last three digits, but the first three digits won't work. However, for n ^ k,

Total Pages: 64722 1 .... 54801 54802 54803 54804 54805 .... 64722 Go to: GO

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.