Problem description: a sequence of A1, A2, A3, A4, A5, A6, A7... is provided .... An, calculate a subsequence of it (set to S1, S2 ,... SN), so that this sub-sequence meets this nature, S1
For example, there is a sequence: 1 7 3 5 9 4 8, and its
# Include using namespace STD; const int maxnum = 100; const int maxint = 99999; // edge typedef struct edge {int U, V; // start point, end Point int weight; // Edge Weight} edge; edge [maxnum]; // Save the edge value int Dist [maxnum]; // minimum
The key to making DP easier is the output path ....
# Include # include # include # define INF 0x7fffffffusing namespace STD; int N; struct CC {int A; int B; void F (INT X, int y) {A = x; B = y ;}}; CC M [105]; int DP [105] [105]; int path [10
The running time is nlgn.
# Include # include # include # include using namespace STD; void input_v (vector & V) {int data; while (CIN> data) {v. push_back (data) ;}} void print_v (const vector & V) {for (vector : const_iterator iter = v.
# Include using namespace STD; char X [30], Y [30]; int C [30] [30]; char B [30] [30]; void LCS () {int M = strlen (x + 1); int n = strlen (Y + 1); For (INT I = 1; I = C [I] [J-1]) {c [I] [J] = C [I-1] [J]; B [I] [J] = '| ';} else {C [I] [J] = C
Due to the poor English, I did not understand the question after reading it for a long time. I finally understood the question by referring to other people's questions. I posted the question directly.
This question is just about understanding
This is the application of a theorem: Median M has the smallest property of the sum of the absolute values of each variable and its absolute deviation values. When N is an even number, the sum of the numbers between num [n/2] And num [n/2-1] and the
When the last digit is 987654321, we can see that there are only eight cases where the last digit is greater than 9. When each player outputs multiple 0 matches, the question is not understood.
# Include # include # include int main () {int N;
Simple DP, but a large number addition applies the class template of the last Daniel.
# Include # include # include # define Maxs 10005 # define maxn 110 using namespace STD; char X [Maxs], Z [maxn]; struct bign {int Len, s [maxn]; bign
A question http://topic.csdn.net/u/20100430/16/3a815617-9d6f-4945-b15c-14dfecfe4b23.html asked before? Seed = 1361273005 & R = 65129463 # r_65129463
At first, I felt that the method for finding the median was quite good. Later I found a
# Include # include # include using namespace STD; int main () {cout : max () : max () : max () : max () : max () : max () :: is_signed :: is_specialized
# Include # include # include using namespace STD; const int num = 3; // void input (vector & V) {int data; while (CIN> data) {v. push_back (data) ;}} void print (vector & V) {for (vector : iterator iter = v. begin (); iter! = V. end (); ITER ++
[LINK]
Http://uva.onlinejudge.org/index.php? Option = com_onlinejudge & Itemid = 8 & category = 113 & page = show_problem & problem = 1657
[Original question]
A palindrome is a string of symbols that is equal to itself when reversed. Given an
Source: http://acm.pku.edu.cn/JudgeOnline/problem? Id = 1251
Solution report:
The typical minimal spanning tree problem is implemented using the Kruskal algorithm.
# Include # include using namespace STD; struct edge { int weight; int U;
Source: http://acm.pku.edu.cn/JudgeOnline/problem? Id = 3414
Solution report:
Or BFS
Set (I, j) to the capacity of bottle 1 and bottle 2 at a certain time point. From this point on, you can reach the following points:
(A, j): Fill (1)
(I, B):
Source: http://acm.pku.edu.cn/JudgeOnline/problem? Id = 1182
Solution report:
This is another question to be combined, but it is a little more complicated than the previous two. After a long time, I searched for other problem-solving reports and
Calculate how many digits of a 32-bit unsigned integer are 1
Counting out the bitsIt is easy to judge whether a number is a power of 2: Clear the lowest 1 bit (see the preceding figure) and check whether the result is 0. however, sometimes it is
Give you a string of numbers, such as "1234567890", encrypted according to the following rules:
1. Replace all 3, 6 with 4
2. Add 2 to all numbers. If the number obtained after adding 2 is greater than 9, replace it with 9.
Problem:
1. Write
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