A tree, which gives an array NUM[1...N], if I is the root, I possesses num[i] a "child", otherwise I own the num[i]-1 "child". Ask the distance between the two points that may be farthest in the possible form of all trees. First of all, it should be
It looks like it can be a little bit faster.
#define REP (I,n) for (int i=0;i= (b); i)
#define FOREACH (i,c) for (__typeof ((c). Begin ()) i= (c). Begin (); i!= (c). end (); ++i)
#define ALL (x) (x). Begin (), (x). End ()
typedef long long
http://community.topcoder.com/stat?c=problem_statement&pm=13245is a string, the character inside can be arbitrarily 22 elimination, if not, then finally if a character, the character is winning letter. If any method is eliminated is this winning
Divi lev2
Define grid. If 0 is null, 1 indicates that there is an obstacle or you have considered it.
Flood fill records the number of flood fill cells in each format.
# Include # include # include # include # include # include #
Div2 lev3
# Include # include # include # include # include using namespace STD; typedef struct node { string Pos; int haskillrook; int haskillqueen; int step; } node; const int coffset [8] = {-2,-2, 2, 2,-1, 1,-1, 1 }; const int
This question is relatively simple. I wrote the example on paper and analyzed it to find the rule :)
MyCode
# Include
# Include
Using NamespaceSTD;
ClassLeaguepicks
{
Public:
Vector Int> Returnpicks (IntPosition,IntFriends,
The first question is very retarded... Easypass
The second problem is that at the beginning, we can see that this problem is beyond our imagination .. Obviously, there is no solution to the higher order equation... After thinking for a long time, I
The question is to give you a group of numbers, then constantly divide the Division (note that the large number is divided by the decimal number), then add the result to the group number, and then continue the division,
Until no new number is added
Now there are n items set V, each piece has a weight Wi, now from the inside to select a set S, so that the items in the V-S can be called out by the items in S, that is, in the left of a balance in the V-S of 1 item, then you must be able to select
Some sharks want dinner, and they want to eat each other. Each pair has a size, speed, and intelligence. Shark A can eat shark B and enter the size, speed, and intelligence of A to be greater than or equal to shark B. In addition, each shark can eat
WalkoveratreeTest instructions: Give you a tree, there is a person in node 0, now ask you, this person walk l step, up to how many different nodes, a node can be walked several times, but only one time.The crux of the problem is that each point is
Objective:As I have been in the DIV2 of the weak dish. I don't know what to say.A: It must be judged that there are 8 ' R ', only one per column per rowQuestion B: Probably int e,int em,int m,int mh,int HThen em can give value to E,M,MH can give
Test instructions: Give you a long W, wide h of paper, ask if you can be a given size, every origami can only be folded into an integer size.Problem-solving Ideas: Recursive + enumeration enumeration of the length and width of a given size, and then
Test instructions: Give a n*m chess board, choose a position (x, y), place a horse, the horse can go to (x-1,y-1), (x-1,y-2), (x-1,y+1), (x-1,y+2), (x+1,y-1), (x+1,y-2), (x+1,y+1), (x +1,Y+2) Eight positions, provided that the board cannot be walked
[Cpp] # include # include # include using namespace std; class BinaryCode {public: vector decode (string message) {// prepare the basic return value vector result; result. push_back ("NONE"); result. push_back ("NONE"); if (message. empty ()
Reprint Source: http://blog.csdn.net/uestc_peterpan/article/details/45534301
the feeling is the knapsack problem Upgrade edition;
Two-point answer, this is a reverse thinking.
Problem
there are n individual, each person blood quantity is a[i],
Problem Statement
The Happy letter game is played as Follows:at the beginning, several play ERs enter the field. Each player has a lowercase 中文版 in their back. The game is played in turns. In each turn, you select the
I have done too few problems >_Find some TC questions to brush it ^_^SRM div1 Hard Lotsoflines
There are y = ax+b (0
Consider that a is the first keyword b for the second keyword to sort the line and then add in a piece and calculate
Test instructions: Ask you between A-B to ask you to choose two numbers to make these two numbers the same number with the same number.Solution Idea: Enumerate all the numbers between a-B, divide the number into 10 binary hash state compression, and
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.