The main idea: in Tex, the left quotation mark is ' ', the closing quotation mark is '. Enter an article with double quotes and your task is to turn him into Tex formatProblem solving: Water problem, define whether a variable tag is an opening or closing quotation mark/*UVa 272 Tex Quotes---water problem*/#include#includeintMain () {#ifdef _local freopen ("D:\\input.txt","R", stdin);#endif CharC; BOOLFlag =0; while((c = GetChar ())! =EOF) {
However, it is the same as a silent calibration process.1#include 2#include 3#include 4#include 5#include string>6 using namespacestd;7 intN;8 BOOLBalintW) {9 intw1,w2,d1,d2;Ten BOOLb1=1, b2=1; Onescanf"%d%d%d%d",w1,d1,w2,D2); A if(!W1) b1=Bal (W1); - if(!W2) b2=Bal (w2); -w=w1+W2; the if(B1 B2 (W1*D1==W2*D2))return 1; - return 0; - } - intMain () { +Cin>>N; - inti,w; + for(i=1; i){ A if(Bal (W)) printf ("yes\n");Elseprintf"no\n"); at if(iEndl;
Test instructions: Give some computer two-dimensional coordinates, connect two computers with the network cable long for their straight line distance plus the feet. Requires all computers to be connected to a string, how to connect, so that the network cable is the shortest, and the order from one end to the other end of the output of the connection between the two computer distance.Idea: It's easy to think of a brute force enumeration that makes all the computers in a whole array, the one with
return false; the } AboutInlinevoidinit () { thememset (SEQ,-1,sizeofseq); theCur=0; the } + BOOLsolve () { - init (); the BOOLok=false;Bayi State U; thememcpy (U, init_p,sizeofu); the if(Tar_num (u) = =8){ -printf"' No moves needed\n"); - } the if(Dfs (U,0)){ theok=true; the get_p (P1); the } - returnOK; the } the intMain () { the 94 while(1){ thememset (P1,0,sizeofP1); the for(intI=0;i -; i++){ thescanf"%d",init_p[i]);98 if(init_p[i]==0
"Title translation":Problem analysis: Because tasks can be executed in parallel, it is intuitively a task that takes a long time to prioritize deployment. But this to the topic also gives you the task of time, so easy to let people think more.There are only two possible cases for tasks x and Y, regardless of the time it takes to account for the task. X ends before y, and x ends after Y. Here it is discussed that X is done before Y.When x and Y positions are not swapped, the completion time is: B
Dollars
Time Limit: 3000MS
Memory Limit: Unknown
64bit IO Format: %lld %llu
Submit StatusDescriptionNew Zealand currency consists of $, $, $ $, $ $, $ notes and $ $, $50c, 20c, 10c and 5c coins. Write a program that would determine, for any given amount, in how many ways that amount may is made up. Changing the order of listing does not increase the count. Thus 20c May is made up in 4 ways:1 20c, 2 10c, 10c+2 5c, and 4 5c.InputInput would consist
With Multiset simulation, it is important to note that erase (val) will delete all values equal to Val, while Erase (iterator) will only delete a value pointed to by the iterator.1#include 2#include 3#include 4#include Set>5 using namespacestd;6 7multisetint>s;8multisetint>:: iterator it;9 Ten intMain () One { A intN; - while(SCANF ("%d", N), N) - { the Long Longsum =0; - s.clear (); - for(inti =0; I ) - { + intm; -scanf"%d", m); +
Topic PortalTest instructions: Give some of the length and width of the bricks, bricks can be stacked on the other side of the long width is smaller than the length of the following head, ask how high can be stacked upAnalysis: Set a brick of the length of the width of x, Y, Z, then want to be more than X, Z, y and y, X, Z of the bricks, if I can be stacked on J, then g[i][j] = True, converted to dag problem, Dp[i] indicates that block I stack at the highest height of the upperHarvesting: Transf
Title: Two-dimensional push box game, gives you the location of boxes, people and targets, the solution of the output problem (push the box and walk the path).Analysis: Search, Priority queue. Priority is: first of all to ensure that the number of words to push the box, followed by the fewest steps to walk.The second fork heap is used as the priority queue, and the BFS can be done on top.Note: Notice the enumeration in dictionary order direction when searching, otherwise WA ╮(╯▽╰)╭.#include
Topic Link: Click to open the linkTest instructions: n beads, the two halves of each bead are made up of different colors. Only the same color can be joined together, asked whether to form a necklace.Idea: If a bead is regarded as a non-forward edge connecting two vertices, then the subject becomes the existence of the Euler circuit for the non-direction graph. For the graph, if the number of degrees are even and the graph is connected, then there is a Euler loop. Then start at any point and wa
Gives a
s
, and then give
n
Set of stamps, ask the group to get the maximum continuous postage.For each set of stamps, find out the minimum number of stamps required when postage is I
d[i]
, the boundary is
d [ 0 = 0
、
d [ i > s
Time break. Similar to the knapsack problem of the method, the specific methods see Code.#include #include #include Using namespace Std;constintmaxn=1010;intd[maxn
Address: Click to open the linkTest instructions: Just buy a 8-point drink, and then you have 1,5,10 three different coins.Then ask to buy a C bottle of drinks, buy one at a time, your minimum coin count.There are several ways we can: 1: Cast 8 one cent 2: cast a 5-point 3 1-point3: Cast a 10 points to find 3 a point of 4: cast a 10 points of 3 a point, find a 5-pointThere are other options but not too cost-effective.#include UVA 10626 Buying Coke (me
first line of the input there would be a single positive integer K followed by K lines each Contai Ning a single test case. Each test case contains three positive integers denoting N, T and P respectively. The values of N, T and P would be are at most 70. Assume that final answer would fit in a standard 32-bit integer.OutputFor each input, print in a line the value of F (N, T, P).
Sample Input
Output for Sample Input
23 34 103 34 10
1515
Idea:
Topic Links:option=com_onlinejudgeitemid=8page=show_problemproblem=1253 ">10312-expression Bracketing Test instructions: There are n x, which requires parentheses to infer the number of non-binary expressions. train of thought: Two the expression of the fork is equal to the number of Catalan, then only the total number is calculated, minus the number of binary expressions. The number of non-binary expressions is obtained. So what is the calculation method? look at the graph in the topic, for t
);//the solution of the equation Aprintf"Point %.2lf%.2lf\n", x, y); the } + Else{ - if(Issameline () = =0){ $cout" Line"Endl; $ } - Else -cout"NONE"Endl; the } - }Wuyi BOOLIntersect::iscross () {//to determine if it is intersecting the if((la.en.x-la.st.x) * (lb.en.y-lb.st.y) = = -(LA.EN.Y-LA.ST.Y) * (Lb.en.x-lb.st.x)) { Wu return false; - } About Else $ return true; - } - BOOLIntersect::issameline () {//determine if the point is on
Test instructions: Give n numbers, reorder them to get a maximum number,Analysis: Write a comparison function each time the call, compare a+b>b+a;1#include 2#include 3#include string>4#include 5 using namespacestd;6 7 strings[ -];8 intN;9 Ten BOOLcmpstringAstringb) One { A returna+b>b+A; - } - the intMain () - { - while(SCANF ("%d", n)!=eofN) - { + for(intI=0; ii) -Cin>>S[i]; +Sort (s,s+n,cmp); A for(intI=0; ii) atcoutS[i]; -coutEndl; - } - return 0; -}
Topic linksTest instructions: Given a string, decomposed into multiple substrings, each substring is a palindrome string, ask at least how many substrings can be divided.ExercisesDp[i] means that the first I string is divided into a minimum number of palindrome substrings;0#include UVA 11584 Partitioning by palindromes (DP)
Similar to a knapsack problem counting problem. (Although I don't remember what it's called.)At first I thought of the state definition is: F[n = and for the n][k of prime numbers].Recursive: f[n][k] = Sigma F[n-pi][k-1].But the question also has a request is the sum of the different prime numbers, in order to ensure that the prime number is different, then first enumerates the primes,F[I][N][K] = Sigma F[i-1][n-p][k-1],And then scroll the array down one dimension just fine.Local sieve once agai
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.