Test instructions: Given a tree with a direction graph, some nodes have pebbles, each time a stone can be taken to a forward edge of the movement, can not be moved negative.Ans: Nim on the tree, the leaf node Nim is 0, the Father node recursive son to get the SG value, the answer is that each stone point of the SG value XOR.1#include 2#include 3#include 4#include 5#include string>6#include 7 intsg[1005],s[1005],n,x,ans,m;8 inttot,go[1005*2005],first[1005],next[1005*2005],ru[1005],num;9 voidInser
dress, but want is not this dress.The difficulty of the algorithm to a certain extent is the reason I like, haha, really sarcastic ah.1#include 2#include 3#include string.h>4 using namespacestd;5 Long Longdp[ +][ +];6 intMain ()7 {8 intN;9 intt=1;Ten for(intI=1; i $; i++) Onedp[i][0]=1; A for(intI=1;i $; i++) - { - for(intj=1;j $; j + +) the { - if(I==J) dp[i][j]=dp[i][j-1]; - Else -dp[i][j]=dp[i-1][j]+dp[i][j-1]; + } -
Test instructionsAn n-row 20-column checkerboard. Each line has a number of pieces.Two people in turn, each time a piece can be moved to the right one position, if it has a piece to the right, skip this piece, if there are a number of pieces, will be the number of skipped.But the pieces cannot move out of the boundary.If there is no way to move, even if you lose. Ask you to go first can win.Analysis:SG with a pressure of a shape.The answer to each column is different or up.1#include 2#include 3#
enterprises in the local broadcast, UGC, VOD, live and other fields have focused; the second stage, with the intensification of industry capital integration, copyright competition more and more fierce, Now all the video sites are still content, with the content of the flow, copyright fees are rising; can with the TV, hardware manufacturers and other full-industry chain participation, the entire industry has entered the third stage, in addition to mobile video competition, video industry competi
Title: http://www.lydsy.com:808/JudgeOnline/problem.php?id=1801Analysis:Only 50 of the state compression ...and then we searched the puzzle and found it was DP.First, it's easy to get up to 2 pieces per row.F[i][j][k] means that there are J columns in the front I row, 1 pieces are put in the K column, 2 pieces are placed in the column, then there are m-j-k.Then consider the relationship between the position of the pawn in line I and the state of the former i-1 line:1. If I do not put a pawn: f[i
UVa Online Judgehttps://uva.onlinejudge.org/index.php?option=com_onlinejudgeItemid=8page=show_problemproblem= 2533Test instructionsGiven a chessboard, put two queens (one white and one black) on the board, and ask the two queens to attack each other (in a row, a column, a diagonal can attack each other), the number of solutions.Counting problems, classification:1. In one row or column: N*m (m-1), m*n* (n-1)2. On the diagonal, assuming nD (n,m) =2* (2*[sum (i* (i-1)]+ (m-n+1) n (n-1)) conditions
http://acm.hdu.edu.cn/showproblem.php?pid=4405Obviously, there is no need to consider the dice when the plane, must be better by planeSet E[i] for the number of steps that are required to walk at the point of I, J is one of the possible points to be cast, if deduced from I to i-j, we are not able to determine the transfer direction of I, because there may be two i-j with a plane whose destination is I, so we choose to derive the desired from I to i+jIf you set g[i] to the number of steps you hav
Be sure to pay attention to the input and output laterFor example, the least-given coordinate of the topic starts from (Then decide if the array is out of bounds.We need to pay special attention.I know the truth.And then because of this problem and when you subtract 1 from the input coordinates,I counted the m,n in the accident.And then you blew me up for one hours.Mom, a chicken.That's the first way to play rank today.I thought about it when I got the title.But did not consider the columnFried
remaining two biggest points have been wrong, and the answer is only a little bit different!! Then I just good again helpless to Pat, about 20 minutes after the n==5 error.Here is the wrong point picture:watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvamlhbmdzagliawfv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center "> later found that the iterator pointer basically every function has, also opened the global variable. In this way, the iterator in find is slightly changed by
Transmission DoorIdea: Classic DP problem, I come to water a water, see the data range should be able to know this is a multidimensional DP, we can set
F (I,J,k,L,m)
I walked the first card with J, the 2nd card with K, the 3rd card with L, the 4th card with the maximum score after M. But we found that this transfer, not only the memory is not open, and the transfer time will be timed out, what to do, we found that the five number is not independent, you can know 4 for 5, so we can si
Results s->setvisible (false); Set the pawn to the initial position S->setposition (CCP (WINSIZE.WIDTH/2, Winsize.height)); Visible = false; Change the color of the player's pawn _redside =! _redside; Set red to go first _redtrun = true; Re-get a new inning (obj);In the Scenegame member function void Scenegame::movecomplete (ccnode* movetone, void* _killid) Add the following code to implement when the red handsome or black will be killed, the game Resu
To a chessboard, need to go from the upper left to the lower right corner, some points can not go, to find a total number of ways to go.The first thing to know is how many ways to go from one point A to another, B, without obstacles. Make sure A is at the top left of B,There is a total need to walk (x+y) step (x, y in the picture), in which the X-step to the horizontal, the Y-step vertical direction. So a total of C (x+y, X) species go.Arrange all the points that cannot be left, and for each poi
=j upper right-left lower diagonal;//diagonal (I,J) satisfies i+j=4+1=5} void Swap (i , j) {i^=j^=i^=j;//How do you write all the same?} int update (int u,int tag)//INSERT, find, Delete to a procedure, because many parts are the same {Int key=u%lm; Gets the collection for (Intk=hd[key];k;k=hash[k].next)//Enumeration data if (HASH[K].DATA==U)//if equal to if (typ==2) return hash[k].has;//If the lookup process returns has else {hash[k].has^=1; The state of has changed return1; Direct E
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.