Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=1285This is a topological sort of template problem, used to learn topological sorting very well. My algorithm 62ms too, the efficiency is very low, but very good understanding, with a structure to record the degree of each point in the degrees to be done;#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. hdu-1285-determining the tournament
Why is it game theory... Go
Orz hzwer, this question can actually be converted into a nim game!
"Step 1:
Remove M (M> 0) from N chocolate bars so that the XOR value of these M chocolate bars is 0, and the remaining N-M chocolate bars are obtained no matter how they are obtained, neither XOR nor is 0.
The sum of the XOR values of M chocolate bars is 0
The rest of the N-M chocolate bars, no matter how it is obtained, XOR and are not 0
Step 2:
After the first step, the opponent will face a defeat
two instructions has a different target location, the two instructions are considered to be not the same.InputThe first line is an integer TT, which represents the T-group data.Each set of data contains an integer n (1 \leq n \leq 1) n (1≤n≤1000000).OutputFor each set of data, output one line of case #i: Then output the result, modulo 10000000071000000007.Sample InputCopy213Sample OutputCase #1:1Case #2:4The subject is a DP topic, first of all to push the value of the first few, when N=1, 1 and
location, the two instructions are considered to be not the same.InputThe first line is an integer TTT, which represents the T-group data.Each set of data contains an integer n (1≤n≤1000000) n (1 \leq n \leq 1) n (1≤n≤1000000).OutputFor each set of data, output one line of case #i: Then output the result, modulo 100000000710000000071000000007.Sample Input213Sample OutputCase #1:1Case #2:4This problem, is a recursive problem, that is, this can only be met in two cases, one is self-The other is t
Test instructionsThere were n teams, and all the teams were going to play it again, and one of them did not give the result of the match.IdeasObviously we can find out which two teams are not given from these pairs.Then is to determine the outcome of the two teams, DFS to determine whether one of the map to the other can be reached.Code#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace STD;#define LL Long
problem, then I think of the addition of initialization errors, But then I think of the idea of avoiding this bug, just after the second search to determine whether the ring on the degree of 1 can be avoided, (correctness needs to be put out after the question to write a verification) after the game also thought of K-Q spacing is not too big problem, but it is already too late.Overall, the game is not very good, the C-question takes too much time, so that the last time is not enough, and then p
Changchun is a good place, the northeast driver is very enthusiasticDo the 3+9h train, night to Dachangchun, tonic + sleepThe next day visit Northeast Normal University, the school is very small but very good-lookingAfternoon some Daniel speech, film style, laugh and cryThen the warm-up, see B, no ideas, puzzled after casually yy a conclusion, 1 A, at this time the bronze first, feel the rhythm of the card tomorrow, then pass the time back to the hotelGo back in the evening to play BC, miserable
are much stronger than I, even if see a I will do the problem, in order to prevent errors, the code will let them knock. Unless you encounter any diagram topics ... I'll go up and knock (three of us seem to have a lot of knowledge of my graph theory).After the game, I took the topic of computing geometry three points ac ... and instantly petrified ... shouted "Ma de! ”。At the end of the race, we went to the East Division Hall to eat a self-service hotpot, 2,483 people, eat full. At night in the
Problem description has N teams (1Other Notes: Qualifying rankings may not be unique, at which point the output is required to be numbered in front of the team; the input data is guaranteed to be correct, i.e. the input data ensures that there must be a qualifying ranking. Sample Input4 31 22 34 3#include #include#include#include#include#include#includeConst intn=505;intDegree[n],res[n];BOOLMap[n][n];intn,m;voidTopo () {inti,j,p; for(i=1; i) {p=-1; for(j=1; j) { if(degree[j]=
HDU 5358Test instructionsBeg ∑ i = 1 n ? ∑? J=i ? N ??(?Lo g? 2 ??S(I,J)?+1)?(I+J). Ideas:S (i,j) Mainly write it is more difficult to some, some details more tangled, a certain way of thinking to clarify and then write.PS. This card constant is not human, you must remember to preprocess the interval mapping, otherwise n (logn) ^2 also have to kneel.Code/** @author novicer* language:c++/c*/#include
Copyright notice: Bo Master said authorized all reproduc
ID Origin Title
96/114
Problem A
Uvalive 4167
Parity
60/124
Problem B
Uvalive 4168
Lampyridae Teleportae
3/11
Problem C
Uvalive 4169
Hex Tile equations
17/41
Problem D
Uvalive 4170
The Bridges of San Mochti
16/36
Problem E
Uvalive 4171
Bulletin Board
2/21
Problem F
Uvalive 4172
ID
Origin
Title
96/114
Problem A
Uvalive 4167
Parity
Water Question 1
60/124
Problem B
Uvalive 4168
Lampyridae Teleportae
Water Question 3
3/11
Problem C
Uvalive 4169
Hex Tile equations
17/41
Problem D
Uvalive 4170
The Bridges of San Mochti
16/36
Problem E
Uvalive 4171
Bulletin Board
2/21
person AC, decisively gave up the problem of E, began to do a problem, 10 minutes to finish the code, ce!! The original missing string header file, and then submit! Array out-of-bounds: Submit again! WA, only to find the sample data is a pit, own two sets of data, WA 3 times, found "= =" written "=", the data is very easy to, or wa! At that time, the game began two hours, a question submitted 7 times, or a place, o written 0, because of the reasons for Codeblock, can not see it. It's time to St
and check the set. Add the edge from the back.#include #includestring.h>#include#includeusing namespacestd;Const intMAXN =1000000+Ten;intFATHER[MAXN], U[MAXN], V[MAXN], Q, Q[MAXN], ANS[MAXN], FF[MAXN];intFindintx) { if(x = father[x]) father[x] =find (father[x]); returnfather[x];}intMain () {intN, M, I; while(~SCANF ("%d%d", n, m) {memset (FF,0,sizeof(FF)); for(i =0; I i; for(i =1; I "%d%d", u[i], V[i]); scanf ("%d", p); for(i =1; I "%d", q[i]); Ff[q[i]] =1; } inttot = n;//there are n sets
Problem-solving ideas: And check the water problems, many years ago with violent water.Problem Solving Code:1 //File name:c.c2 //Author:darkdream3 //Created time:2013 March 01 Friday 00:37 28 seconds4 5#include 6#include string.h>7#include 8#include 9#include Ten One BOOLa[102][102] = {0}; A intf[102]; - intb[102] = {0}; - intMain () { the - //freopen ("Input.txt", "R", stdin); - //freopen ("Output.txt", "w", stdout); - intN, m, p =0; +scanf"%d%d",n,m); - for(inti =1; I ) + { A
][j]); the printf ("******\n"); - }*/ $ while(!qu.empty ()) the { theQunode tmp =Qu.front (); the //printf ("%d\n", tmp.num); the Qu.pop (); -Mians = min (mians,yd-p[tmp.num].y); in the if(Tmp.num = = n+1) the { AboutOK =1; the returnTmp.step; the } the for(inti =0; i ) + { - if(!Vis[mp[tmp.num][i]]) the {Bayi //printf ("%d to%d\n", Tmp.num,mp[tmp.num][i]); theVis[mp[tmp.num][i]] =1; t
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.