Sgu-520-Fire in the Country

A undirected connected graph with n vertices and m edges. At the beginning, node 1 caught fire and it took one day for the fire to spread to its adjacent vertex. At the beginning, a robot was also located at Node 1, however, when the robot leaves,

Expectation for solving the Gaussian elimination equation of hdu 4418

Question: A person walks back and forth in a line segment (changes the direction when the line segment endpoint is met). Now he starts from the starting point and has an initial direction, Steps 1, 2, 3... m can be taken each time, which corresponds

Maximized average-Binary Search

The weight and value of n items are w [I] and v [I] respectively, and K items are selected to maximize the value of unit weight. 1 1 The general idea is to sort items by unit value, and then select items by greedy, but this method is incorrect and

BNU Concentric Rings

  There are several different concentric rings on the ground. some of them may overlap. in Figure 1, there are 3 rings: blue, green and red. the red one is just above the green one. the problem is to remove minimum number of rings so that no two of

HDU 1505 & amp; POJ 1964 City Game (recursive + scanning)

A matrix. Some grids are F and some are R. You need to find the largest sub-matrix so that all the matrices are F. Idea: enumerate each sub-Matrix directly, obviously the complexity is O (m ^ 3 n ^ 3), obviously TLE. We can use scanning method: up

Sprintf_s converts an int array to a char array

Function: Format and output data to a string. Sprintf_s () is a secure version of sprintf (). You can specify the buffer length to avoid the Overflow Risk of sprintf (). Test code: // MatchTest. cpp: defines the entry point of the console

Ultraviolet A 1484 Alice and Bob's Trip (tree dp)

Source: Ultraviolet a HDU   QuestionA tree with n nodes numbered 0 ~ N-1, vertex is 0Each edge has a weight.Alice and Bob start at the vertex and go down to the leaf node.For the first time, Bob chooses the child node to go to, and for the second

POJ 1655 Balancing Act [center of gravity of the tree]

#include #include #include #include using namespace std;#define N 20010int s[N], f[N], n, root;vector g[N];void getroot(int now, int fa) { int u; s[now] = 1; f[now] = 0; for (int i=0; i  

Hdu2159 two-dimensional full backpack

# Include using namespace std; # define MAXN 105 int n, m, k, s; int C [MAXN]; int W [MAXN]; int dp [MAXN] [MAXN]; int ans; // dp [I] [j] [k] = max (dp [I-1] [j] [k], dp [I] [J-1] [k-C [I] + W [I]); // dp [j] [k] = max (dp [j] [k], dp [J-1] [k-C [I]

HDU 4670 Cube number on a tree

#include #include #include #include #include #include using namespace std; const int N = 5e4+10; const int K = 32; typedef long long LL; struct edge_t { int v, to; }; vector E; int L[N]; void init(int n) { E.clear();

HDU 1312 Red and Black DFS (deep first search) and BFS (breadth first search)

Red and BlackTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission (s): 6762 Accepted Submission (s): 4284   Problem DescriptionThere is a rectangular room, covered with square tiles. each tile is colored

POJ 1159 Palindrome (Dynamic Planning)

PalindromeTime Limit: 3000 MS Memory Limit: 65536 KTotal Submissions: 48269 Accepted: 16570 Description A palindrome is a regular rical string, that is, a string read identically from left to right as well as from right to left. you are to write a

(Step 4.3.5) hdu 1035 (Robot Motion -- DFS)

Enter three integers, n, m, and k, indicating that there is a map with n rows and m columns next. A robot enters from column k of the first line. Ask how many steps the robot can take. If a loop occurs The number of steps in the output

Ultraviolet A 537

Physics teachers in high school often think that problems given as text are more demanding than pure computations. After all, the pupils have to read and understand the problem first! So they don't state a problem like ''U = 10 V, I = 5A, P =? "But

UVA216 Getting in Line

  Use profiteering to enumerate all possible arrangements and find the minimum cost. Use an array to save the input, use an array to generate an arrangement, and use another array to save the arrangement of the current minimum cost.   For (int I = 0;

Ultraviolet A 108 Maximum Sum (largest and largest sub-matrix)

Maximum Sum   BackgroundA problem that is simple to solve in one dimension is often much more difficult to solve in more than one dimension. consider satisfying a boolean expression in conjunctive normal form in which each conjunct consists of

Ultraviolet A 507 Jill Rides Again (the largest and most problematic continuous subsequences)

Jill Rides Again Jill likes to ride her bicycle, but since the pretty city of Greenhills where she lives has grown, Jill often uses the excellent public bus system for part of her journey. she has a folding bicycle which she carries with her when

Two points of hdu2962 + shortest

TruckingTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission (s): 1473 Accepted Submission (s): 509 Problem DescriptionA certain local trucking company wowould like to transport some goods on a cargo

POJ 3164 minimum tree structure

This is the basic question of the minimum tree structure. I will not go into details about the meaning of the question. When I think about this question, I find it very difficult. Because I often use input optimization when I input them, I usually

Least tree structure with a maximum of 6199 square meters

The first is the introduction of the minimum tree structure. Read this blog. Minimum Tree Structure I have introduced the question in detail. First, two-dimensional coordinate points are given. These coordinates constitute some Directed Graphs.

Total Pages: 5902 1 .... 3268 3269 3270 3271 3272 .... 5902 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.