An Object-Oriented story
The most important concept of object-oriented programming language is undoubtedly class, and everything is object. (but if I write code in front of a computer every day to study object-oriented languages, it is very
The coordinates of n locations and the weights of each location are given, that is, n vertices in a graph. vertices have edge weights. Now the referee is at point 1. You need to assign these referees to these points. It is known that the sum of the
Let's first understand what is a class?Class is the encapsulation of logically related functions and data.Below is my summary of the class:
Knowing a class starts with its members:The class has1. Data Member-attribute2. member functions-methods
The implementation interface is as follows: (the source code is provided at the end of this Article. If you are writing a technical blog, please criticize and correct it)
Implementation process:
1. Create a DLG-based MFC application named tryBGDlg,
Greedy, find the farthest Delete# Include # Include # Include # Include # Include # Include # Include # Include # Include # Include # Include # Include # Include Using namespace std; # Ifdef _ WIN32# Define i64 _ int64# Define out64 "% I64d \ n"#
This question can only be checked for each vertex ......The directed graph can use floyd, but SPFA is used due to the time limit.
[Delphi]Program aa;ConstMaxk = 10000;Maxn = 10000;Maxm = 10000;VarK, n, m, I, j, l: longint;A: array [1 .. maxk] of
Simple greedy idea: add the maximum number to s [I] [j] + = max (s [I + 1] [j], s [I + 1] [j + 1]);
[Cpp]# Include [Cpp]# Define max (a, B) (a)> (B )? (A) :( B)Int s [100] [100];Int main (){Int c, n, I, j, B;Scanf ("% d", & c );While (c --){Scanf ("%
Question: Maximum subsegments and
Simple line segment tree, but it has been written for a long time ~~~ Kneel
Maintain three values, the maximum sub-segments and the range, the maximum continuous sub-segments and the maximum sub-segments and
Query
[Cpp] converts a binary search tree into a sorted two-way linked list question:Enter a binary search tree and convert it into a sorted two-way linked list.You must not create any new node. You only need to adjust the pointer point.10//6 14////4 8 12
Recently, I felt that the dual division was under a huge pressure, so I made a dual division problem with my sister. It was a good question, but no one could tell us that we were too weak. Continue to cheer up, and I want to become a big cow, do not
[Cpp]/*The line segment tree is very powerful. This should also be a problem of interval processing and multiple queries, so it must be solved by the line segment tree.Sum [] indicates the sum of the remainder of % 5 in the interval, and cnt
Question: How many posters can be viewed in the end.
Question: Recently I want to write a question about rectangular cutting. Of course, this question is not very suitable, but I can pass it.
[Cpp]# Include # Include # Include # Include # Include #
2012 Multi-University Training Contest 101005 questionsGiven N, find the smallest M, and make M ^ 2% 10 ^ x = N.N
From the low position to the high position, if the current situation meets M ^ 2% 10 ^ y = N % 10 ^ y, continue to the downward search.
You can be greedy if you have played reton.Small equals 2 persons: 1, 2->3 people:1, 3->1 1, 2->1 Otherwise:1, 2->2 Max1, max2->1 OR:1, max1->1 2, max2->2
Data scale-2
[Delphi]Program P1700;VarT, n, I, j: longint;L, r: longint;A: array [1 .. 1000]
A * B ProblemTime Limit: 1000 MS | memory limit: 65535 KBDifficulty: 2DescriptionDesign A program to obtain A * B, and then add each bit in the result to get C. If the number of digits in C is greater than or equal to 2, add the numbers in C, until
To search for water questions, you need to pay attention to the search skills. First, we need to pre-process the questions to facilitate debugging and modification. See the following example:
[Cpp] www.2cto.com// Preprocessing of vertices to be
[Cpp]/*Dp [I] [1] indicates the maximum value that can be obtained from the subtree with I as the followed node when node I is selected, while dp [I] [0] indicates the maximum value when I is not selected,Dp [I] [0] + = max (dp [j] [0], dp [j] [1]),
This question is very simple. Find a path in a tree to make it different or right (that is, the weights of all edges in the path are differentOr up) the maximum.This question takes two steps. The first step is to assume that the root is node 0, find
The main task is to define a new method in the main. cpp file where the main function is located to forward debugging information. The function is as follows:[Cpp]Void myMessageOutput (QtMsgType type, const char * msg ){Std: fprintf (stdout, "% s \
Give some rectangles to calculate the area of these rectangles. A rectangle is the coordinates in the lower left corner and lower right corner. It is a positive integer.Idea: a simple line segment tree question is to find the rectangular area.
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