Topic Transfer: UVA-571Idea: A is empty when the full, not empty will pour to the b,b full after the full fall, until the capacity of B is n (reference)AC Code:#include Uva-571-jugs (number theory-classic pour water problem)
https://vjudge.net/problem/UVA-253Test instructions: Enter the six-sided color of the two dice and determine if it is equivalent.Idea: The most I think of is violence, but always wrong, do not know where is wrong. The second method is to appear in a dice in a pair of colors in the second dice also have, as long as three pairs of colors are matched successfully, then is equivalent.1#include 2#include string>3#include 4 using namespacestd;5 6 Charstr[ -
Title Description: Enter a number of lines of code, in accordance with the required format output. Each column of words as far as possible to the left, the word between at least one space.Idea: Use a string array to find the law. As long as the boundaries are controlled, the rest is simple. Even the test cases are useless because the UVA Web page is not being brushed. Directly to the code quicksubmit, just worry will time out, but the result is surpri
Topic Link: UVA 10228-star not a Tree?Topic: Given a number of points, the cost of the horse point (distance from all points and the smallest point)Problem-solving ideas: Simulated annealing algorithm, every time to the surrounding the attempt to move the step size, assuming that the more advantages, then transfer. After each operation, the same operation is done after decreasing the step size until the step is less than the specified precision.#inclu
UVA 11423-cache Simulator (tree-like array)option=com_onlinejudgeitemid=8category=523page=show_problemproblem=2418 "style=" "> Topic LinksThe main idea: mimic the working mechanism of disk buffers, give you n a different size (incremental) disk buffer. Give you access to the data, according to the LRU principle, ask each size of the disk how many times miss (data is not in the cache is Miss).Problem-solving ideas: Because the data has 10^7, so the dat
Chain of title:https://vjudge.net/problem/UVA-10652ExercisesCalculate geometry, Andrew asks for convex hull,Bare title ... (The array is small, but also the whole day ...) )Code:#include UVA 10652 Board Wrapping
Topic Links:https://cn.vjudge.net/problem/UVA-119881 /*2 The problem is that a piece of text after a certain rule processing output, the rule is [the home key, indicating that the cursor jumps to the beginning of the line,] means the end key, indicating that the cursor jumps to the end3 4 Thinking of solving problems5 It can be found that [] can be nested, using pure simulation is more complex, similar to the next array in the KMP, record the next cha
UVA 10602 Editor NottoobadCompany Macrohard have released it ' s new version of editor Nottoobad, which can understand a few voice commands. Unfortunately, there is only a voice commands that it can understand– "repeat the Last word", "delete the last symbol" . However, when one uses ' repeat the last word ' the editor inserts a blank that separates the words. But the company claims that it was possible to type much faster–simply by less number of pre
Topic Links:https://vjudge.net/problem/UVA-10305#author=goodlife2017Title DescriptionJohn has n tasks, but some tasks need to be done after some other task.InputInput has multiple sets of data, the first row of each group of data has two integers 1 and m. n is the number of tasks (labeled 1 to n), andm two task direct relationships. After this, there are m rows with 2 integers i and Jon each line, representing that task I must be completed before tas
The problem with UVA is that the application of data structure is the application of union find and check set. Use path compression primarily. There is not even a need to merge the tree, because there is no repeated connection and changes to the single parent node operation.Depressed is not too familiar with this OJ system, unexpectedly use the ABS in the library will WA, wrote an ABS small function on the past.Title: http://uva.onlinejudge.org/index.
Pretty water simulation problem, just start to read the wrong question, POJ unexpectedly passed ... Helpless. UVA decisively WA the
After a change of the meaning of the title, over UVA.
The problem requires simulating block movement:
There are N (0
Move a onto B put the bricks on A and b back to the original position before moving a to B
Move a over B puts the building blocks on a to the back of the origina
and Summary:
The title can be seen, for applications A to B, then must have a corresponding from B to a, and the number must also be relative. For example, there are two A to B, but only one B to a, then it is not.
So, we can give an ascending sequence 0,1,2,3,4,5,...... N, which exists in the array arr, for each application form, assuming a to B, swap (Arr[a], arr[b).
When all is done, determine if the sequence is still the same as the original arrangement. If so, it is eligible. Otherwise,
Topic Link: uva-10688
Http://uva.onlinejudge.org/index.php?option=com_onlinejudgeItemid=8category=514page=show_ problemproblem=1629
Meaning
There are n apples, and a number k, the weight of the first Apple is K+i (1
All that is lighter than it is bitter, heavier than it is sour.
In order to find the sweet apple, it is necessary to eat it one by one, and eat and bite the apple must eat it, no matter whether the apple is bitter or sour.
We can choose
road, each station for the 1,2,3...S, each station between the value of this section of the road is different, such as Station 1 to the station 2 goodwill is 5, station 3 to the station 4 goodwill is-3. To find a continuous station of the degree of goodwill and the maximum is how much.
Analysis and Summary:
Maximum continuity and problems, there are several algorithms, the fastest one of which is O (n), only need to scan once.
Suppose you use an array to arr the degree of goodwill, then set
every word in order, and then to judge whether the word is a compound, and that is the output.
The core of this question is how to determine whether a word is a compound, by the definition of compound words, you can split the word into two, enumerate all the split schemes of a word, and then judge whether the two words that are split are in the dictionary.
The amount of data on the topic is 120,000, so be sure to find a quick way to determine whether a word belongs in a collection of dictiona
gems will disappear.
Analysis and Summary:
The topic is very interesting, but ... This problem involves a simulation process that increases the level of nausea in the previous question to a number of levels ...
You need to simulate the movement of gems and aircraft throughout the map, and then eliminate the same gems that are adjacent to each other.
Simulation of the process is good, but also a big step towards AC.
Then it's like doing a general implicit graph Search + hash weight.
There
line.Sample input:
3
7
4
13
Sample output:
Case #1:7 is a Happy number.
Case #2:4 are an unhappy number.
Case #3: a Happy number.
The main effect of the topic:
The so-called happy number, is to give a positive s, and then calculate it each bit on the square sum, get its next number, and then the next number to continue and select the square sum of each bit ... If it has been counted down, there have been no previous numbers and appeared 1, so congratulations, this is a happy number.
Problem eeasy problem from Rujia Liu?
Though Rujia Liu usually sets hard problems for contests (for example, regional contests like Xi ' an 2006, Beijing Wuhan, or UVa OJ contests like Rujia Liu's presents 1 and 2), he occasionally sets easy problem (for example, ' the C Oco-cola Store ' in UVa OJ-encourage more people to solve his problems:DGiven an array, your task is to find the k-th occurrence (from
Meaning
For a tree n nodes, the node number is 0~n-1, and the vertex is 0.
Each side has a weight value.
Alice and Bob start at the apex and go down to the leaf node.
The first time is from Bob to choose which child knot, the second turn to Alice, in turn go down ...
Each edge gets the right value, and Bob hopes that the bigger the path, the better, and that Alice hopes the smaller the better.
Each time they will choose the optimal solution.
The final total weight should be within the ran
Output
The input consists of an array of integers. The input begins with a single positive integer N in a line by itself indicating the size of the square two dimen Sional Array. This is followed by integers separated by white-space (newlines and spaces). These are integers make up the array in row-major order (i.e., all numbers on the "the", left-to-right, then all numbers o n the second row, left-to-right, etc. N May is as large as 100. The numbers in the range [-127, 127].
The output is th
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.