Uva_10079
When we cut the nth knife, we have at most n-1 intersections with n-1 straight lines, and N new small areas are created. Then f (n) = f (n-1) + N, then we can get F (n) = N * (n + 1)/2 + 1.
# include
# include
string . h>
Uva_10157
We can look at the leftmost "(" and Its paired ")" as a group boundary. They divide the remaining parentheses into two parts: internal and external, the maximum depth is D-1, and the maximum depth is D. Let's set f [I] [J] to indicate
Uva_10308
Because the source image is a tree, we only need to specify a tree root to create a tree, then, all paths can be viewed as "Son A + son B" with the parent node as the slave node (of course, only one son can be handled in the same way ),
Uva_11176
At the beginning of this question, I tried to calculate the total number of consecutive W cases that would not exceed J, but later I found that complexity n ^ 3 could not be lowered, then I read the tips on the Forum and finally wrote
UVA_10564
We can use f [I] [j] [k] to indicate whether the value of the path to the j-lattice of row I can be k or not. To ensure the minimum Lexicographic Order of the recorded path, we can change the I cycle from large to small.
The idea of state
UVA_11027
First, if you want to form a return string, you can only have an odd number of letters at most.
Then we may want to find the nth input string, so we should first pick the smallest pair of lexicographic orders at both ends, so that we can
UVA_10599
At the beginning, I took into account the situation that a single point had multiple spams. Later I handed in and found that this was not the case.
Because this question can only go to the right or down, and the route is different from the
UVA_10128
This topic was originally thought-provoking by arrangement and combination. After reading other people's problem-solving reports, we found it easier to think about it by recursion.
Let's talk about the thought of arrangement and
UVA_557
This question once again made me feel the simplicity and beauty of mathematics ......
First of all, it is difficult to calculate the probability of a coin directly, because we need to consider who the coin will be thrown, however, it would
UVA_10229
Use a matrix to represent the Fibonacci number, and then perform a rapid power modulo.
#include#include#define MAXD 50long long int N, M, D, a[MAXD][4], b[4];void pow_mod(long long int n, int e){if(n == 1) { a[e][0] = a[e][1] = a[
Uva_000043
The description of this question seems to be a bit problematic. The intention is to determine the number of non-negative integers not greater than N for K so that the sum of K integers is N.
This problem can be equivalent to placing N
UVA_10236
This question is too hard for AC, And I have once again deepened my understanding of the floating point number error. It is best for the library function to be untuned or not ...... In fact, later I felt like a person on the Forum said
UVA_548
The intuitive idea is to first build the tree and then dfs. Then, after looking at other people's problem-solving reports, we can find that we don't actually need to build a tree, because the process of building a tree is also a process of
SGU_108
This question can be screened out directly, but pay attention to several issues: ① The array is not big enough, but because the range of influence before and after the inference is not big, we can use the array in a loop, add a modulo
Uva_000021
We can set f [I] [j] to indicate the total number of cases when the I bar ends with the j unit, then f [I] [j] = sum {f [I-1] [k]}, j-k
# Include # Include # Define MAXD 60Int N, K, M;Long int f [MAXD] [MAXD];Void solve (){Int I, j,
UVA_10602
This question can be done with greed.
Let's take a look at this greedy idea. Every time we spell words that require the least number of characters to press, can we do this? In fact, we can find such a
SGU_109
At first, we didn't see that there was a range limit on the Ki, So we constructed the simplest case. First we moved one step and then deleted all the three except the three in the upper left corner, next, move three steps and delete them
Uva_000012
At first glance, the data is relatively large. In fact, the length cannot exceed 26, and the total weight cannot exceed 351.
We can use f [I] [j] [k] to indicate the total number of cases where the current string length is j and the total
UVA_10400
This question can be solved using dp. If f [I] [j] is used to represent the number of I, it is possible to obtain j. If the possible value is 1, otherwise the value is 0. Since there is a negative number, we can add j to 32000 and then
UVA_10205
This question is like a simulated question, but it hurts to read data.
We can always record the card at each position, but every time we move it, we must use a temporary array, because in the process of moving, we need to know the cards at
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