Link:
Http://acm.hust.edu.cn/problem.php? Id = 1010
Question:
Description
There is a string. the length of a is less than 1,000,000. I rewrite it again and again. then I got a new string: aaaaaa ...... now I cut it from two different position and get a new string B. then,Give you the string B, can you tell me the length of the shortest possible string.For example, a = "abcdefg". I got ABCDEfgabcdefgabcdeFgabcdefg... then I cut the red part: efgabcde
Label: style blog color Io OS AR for strong sp
Question
Give a map of N * m, S: Start Point, D: end point, X: obstacle,.: a grid that can be taken
Give a time t and ask if it can be used to start from the start point to the end point. Take one step as a time.
Note: you cannot go through the grid.
NOTE 2:Time t arrivedInstead of less than T! That is to say, you can make a detour on the map. It will arrive at T!
Analysis
Very common deep search, but there are 2 pointsPruning:
1. pruning after read
UI. According to kihof's current law, the current flowing into a vertex is equal to the current flowing out, so for any vertex I, there is a Σ (ui-UJ) /rij = 0, where vertex J is the adjacent contact of I
This formula is available for each vertex, so now it is n unknown and n equations, which can be solved by Gaussian elimination element.
In order to facilitate the solution, an initial current of 1 can be sent to the entire circuit, starting from point S and starting from point T.
Then, at init
Original question address: http://acm.timus.ru/problem.aspx? Space = 1 amp; num = 1010
The topic is defined in {1, 2, 3, 4 ..... the discrete function on n}, n
After reading the questions, I naturally want to enumerate the connections between every two points. The time complexity is O (n square ).
At the beginning, WA searched other people's code online and found that the AC code is the absolute value of the two-point difference. for example, for
It is worth looking at the Classic Deep Search questions of hangdian 1010 ~~ExplanationI. Parity pruningFor example, 4*4 Matrices1 0 1 00 1 0 11 0 100 1 0 1Steps from 1 to 1 from 0 to 0 must go through an even number.Steps from 1 to 0 from 0 to 1 must go through an even number.So we can determine whether it is true based on the time and time.For example4 4 5S. X.. X.. X.D...Code:Int dis = abs (bx-ex) + abs (by-ey );If (dis + t) % 2! = 0) {printf ("NO
When installing RAC, the system will prompt you to enter the dedicated node (host), public node (public), virtual node (vip)-These nodes are all set in the system etc file. the public node is used for external or internal personnel to view data. dedicated Network is used for Oracle internal communication (management ). the virtual node is used when the master node oracle database or database system cannot be used, oracle will automatically switch to its corresponding virtual node. for example
. Inputthe input consists of multiple test cases. The first line of all test case contains three integers n, m, and T (1 ' X ': a block of wall, which the doggie cannot enter;' S ': The start point of the doggie;' D ': the Door; Or'. ': an empty block.The input is terminated with three 0 ' s. This test is a not-to-be processed. Outputfor each test case, print on one line "YES" if the doggie can survive, or "NO" otherwise. Sample Input4 4 5S. X... X... Xd.... 3 4 5S. X... X.... D0 0 0Sample Outpu
; - return; - } - intS1 = x-DX; + intS2 = y-dy; - intAns = t-time-abs (S1)-ABS (S2);//pruning, if the current remaining required number of steps minus the puppy + if(ans0|| ans%2)return;//if the number of steps in the current position and end point is not even, the end A for(inti =0; I 4; i++) at { - if(Map[x + d[i][0]][y + d[i][1]] !='X') - { -Map[x + d[i][0]][y + d[i][1]] ='X'; -DFS (x + d[i][0], Y + d[i][1], time+1); -Map[x + d[i][0]][y + d
topic links >Main topic:There is a string a, rewrite a A, will get a new string aaaaaaaa ...., now cut this string from a portion to get a string B, for example a string a= "ABCDEFG". Copy a few times to get ABCDEFGABCDEFGABCDEFGABCDEFG ...., now cut the middle red part, get the string B, now just give the string B, and find out the length of the string A.Problem Solving Analysis:It is not difficult to find that the definition of a is actually the shortest circular section in the string definiti
Title Description:
Read in two positive integers a and B less than 100, calculate a+b.
It is important to note that each digit of A and b is given by the corresponding English word.
Input:
The
test input contains several test cases, one row for each test case, the format "A + B =", and two adjacent strings with a space interval. When both A and B are at the end of 0 o'clock input, the corresponding result is not output.
Test instructionsThere are n toys, to be divided into groups, toys with the same width, but the length of C may be different . Give the order of n toys, any number of consecutive toys can become a group. The cost of the interval [i,j] becomes a group of cost= (J-i+sigma (Ck)-L) 2 and I. Given N and L and the length of each toy, what is the sum of the costs after the question is grouped? (nIdeas:Note: The cost is not a straight line function, the total length of each group + the number of toys cl
Operating system is our basic conditions for the operation of computers, learn the operating system knowledge to help us in the future development. To learn the operating system will be a good class, more reference to some information, Internet access to the operating system Information technology,Have a certain understanding of its technology in time. I've heard people talk about the operating system before, but now it's the first time, it feels hard and it's not easy to learn. However, the dev
the doggie;' D ': the Door; Or'. ': an empty block.The input is terminated with three 0 ' s. This test is a not-to-be processed.Outputfor each test case, print on one line "YES" if the doggie can survive, or "NO" otherwise.Sample Input4 4 5S. X... X... Xd.... 3 4 5S. X... X.... D0 0 0Sample Outputnoyes//First search question, learning odd-even pruning, odd-odd = even even number-even = even but odd-even = odd#include #include#includeusing namespacestd;intn,m,t;Chardata[Ten][Ten];intKi,kj,zi,zj,
for the subject.The main pruning method should be one: the maximum number of spaces and the number of steps. That is, assume that the space number is born grids. And the need to walk the T-step, grids And, of course, a second pruning: Assume that the current position to the target location requires at least steps steps. If you need to take a T-step, then steps > t, you can be judged No.It just turns out that the first pruning method is only needed.The second pruning is of little use, for the re
(intI=1; i) A { + intTmp=inf, k=a[i].x; the if(11 K +11) Tmp=min (tmp,k+1); - if(11 n-i-k+11) Tmp=min (tmp,n-i-k+1); $ if(tmp==inf) the { theflag=0; the Break; the } - intL=1, r=N, now; in while(lR) the { the intMid= (l+r) >>1; About if(S.ask (mid) >=tmp) the { thenow=mid; ther=mid-1; + } -
Topic Connection:http://www.lightoj.com/volume_showproblem.php?problem=1010Title Description:There is a n*m chess board, according to the rules of the horse in the game, asked how many horses the board can store, and any two horses will not attack each other.Problem solving ideas;The chess board can be seen from the title, if we only put the horse in a white lattice or just put the horse in the Hegez words are legitimate, but is not optimal?Consider it carefully and you can draw:When min (n, m)
Title DescriptionThere is a total of a staircase of M-class, just at the beginning of you in the first level, if you can only step up one level or two, to go to the grade m, how many kinds of methods?InputThe input data first contains an integer n, which represents the number of test instances, followed by n rows of data, each containing an integer M (1OutputFor each test instance, please output the number of different methods.Sample Input223Sample Output12IdeasClassic DP topic. What is the rela
Test instructions: A maze of n*m, from the starting point to the end point, ask whether it can arrive at T unit time;Idea: DFS traversal various possible situations, parity pruning;#include #include#include#include#includeusing namespacestd;Charmm[ -][ -];intvis[ -][ -];intdir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};intN,m,t,s1,s2,e1,e2,flag;voidDfsintT1,intT2,intStep) { inti,j,k; if(flag)return; if(t1==e1t2==e2step==t)//The remaining number of steps is the same as the remaining time parity, which
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.