not understand. Basically it means to mark a picture from the beginning of the big, at the same time for points connected to the mark Point du++, the next mark is unmarked Point du the largest point, so as to form a queue in order to dye the queue, each Dianran the smallest color is OK, I do not know why this is right ...1#include 2 intn,m,cnt,ans,u,v,x,t;3 inthead[10005],du[10005],q[10005],col[10005],hash[10005];4 BOOLvis[10005];5 structdata{intTo,next;} e[2000005];6 voidInsintUintv)7{e[++cnt]
0;}4. Operation Results and AnalysisStart Page and help :dir command:CD command:Date command:Time command:Iv. Summary of the experimentIt is not difficult to write a DOS command interpreter, but it takes some time to do it. Defines an array that holds commands and uses the STRCMP function to determine whether strings are equal. In the process of running the error, is a two-dimensional array of numbers set too small to cause problems, after modification, there is no error. This clearly shows the
Input23 31 22 33 14 41 22 33 44 1Sample Output02Test instructions: Give an image without a direction. The edges are dyed white or black in turn, so that the number of white and black edges associated with each point is the same. Ask how many methods of staining are available.Ideas:Search questions. Forced violence searches must be timed out. Enumeration points to search is also not good to write. So enumerate the edges.Record the degree of each point, if a bit of degrees is odd, direct output 0
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
-old can be fu chess what result, the Cai Wenji can distinguish the piano Shaidao can sing the harp and Conning men when the Tang Liu Yanfang seven-year-old to raise a child prodigy, although the young body has been er young learning mian and to Night Watch chicken crows louder than gou do not learn Horeb for silkworm silk honey people do not learn as well as things young and learn strong and go to June under Zeminyan fame parents light in front Yu in the descendants of the son Kim I teach son b
Test instructions: number n, is (n+d)%23==p, (N+d)%28==e, (n+d)%33=i;Reprint please indicate source: http://www.cnblogs.com/dashuzhilin/;Idea: Chinese remainder theorem. Using the additive of congruence, the (n+d) is split into three number a,b,c,Make a%23==p,a%28==0,a%33==0;Make b%23==0,b%28==e,b%33==0;Make c%23==0,c%28==0,c%33==i;Then (n+d) = = (A+b+c) +LCM (23,28,33) *t;So, we can do the optimization, initially, the p,e,i are 1, namely:Make the A%23==1,a%28==0,a%33==0;a a multiple of 28 and 3
At the beginning of every day, the first person who signs in the computer, the unlock, and the last one who Signs out would lock the door. Given the records of signing in's and out ' s, you're supposed to find the ones who has unlocked and locked the door on th At day.Input Specification:Each input file contains the one test case. Each case contains the records for one day. The case starts with a positive integer M, which are the total number of records, followed by M lines, each in the format:I
form "days" even if the answer is 1.Sample Input0 0 0 00 0 0 1005 20 34 3254 5 6 7283 102 23 320203 301 203 40-1-1-1-1Sample OutputCase 1:the Next triple peak occurs in 21252 days.Case 2:the Next triple peak occurs in 21152 days.Case 3:the Next triple peak occurs in 19575 days.Case 4:the Next triple peak occurs in 16994 days.Case 5:the Next triple peak occurs in 8910 days.Case 6:the Next triple peak occurs in 10789 days.SourceEast Central North America 1999The main idea-human beings are born wi
Zoj problemsTime limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 2935 Accepted Submission (s): 889Problem description The given string (including only ' Z ', ' o ', ' J ' three characters) to infer if he can AC.Whether the rules of the AC are for example the following:1. Zoj can ac;2. If the string form is XZOJX, it can also be AC, where x can be n ' o ' or null;3. If the AZBJC can be AC, the Azbojac can also be AC. The a,b,c is n ' o ' or empty;I
> Analysis>> Three Cycles is three Inma, can be very simple to use the Chinese remainder theorem> attached Code1 /* -------------------------2 * Chinese remainder theorem3 * -------------------------*/4#include"stdio.h"5 6 intMainvoid)7 {8 intp =0, E =0, i =0, d =0 ;9 intDays =0 ;Ten intCount =0 ; One A while(1) - { -scanf"%d %d%d%d", p, e, i, d); the if(-1==d) - Break ; - - /*5544 is the common multiple of 28 and 33, and 5544% is 1*/ +
At the beginning of every day, the first person who signs in the computer, the unlock, and the last one who Signs out would lock the door. Given the records of signing in's and out ' s, you're supposed to find the ones who has unlocked and locked the door on th At day.Input Specification:Each input file contains the one test case. Each case contains the records for one day. The case starts with a positive integer M, which are the total number of records, followed by M lines, each in the format:I
23 c*1, that is, more than C.So the conclusion is that 5544*p is divided by 23 and the remainder is divided by 28, divided by 33.14421*e divided by 28 E, divided by 23, divisible by 33, divided by1288*i divided by 33 I, divided by 23, divisible by 28.So these three add to meet the conditions, but not necessarily the minimum value, how to find the minimum value%LCM (23,28,29) can be.Code:#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not rep
1003,1004, 1005 too much water, not recordedCode. 1006 is also very simple. It is just a problem of undefined equations, because the problem is not clearly described, or because my mind is dizzy because I am not sleeping at noon, after reading the question several times, I did not understand what the meaning of the data is. I understood it only after reading the Chinese translation several times.
# Include
Using namespace STD;
Int main ()
{
common subsequence is represented as follows:Set sequence x=
If Xm=yn, then Zk=xm=yn and Zk-1 are the longest common subsequence of Xm-1 and Yn-1;
If Xm≠yn and ZK≠XM, then Z is the longest common subsequence of Xm-1 and y;
If Xm≠yn and Zk≠yn, Z is the longest common sub-sequence of x and Yn-1.Among them Xm-1 =
We define C[i, J] to denote the length of the LCS of Xi and Yi. If I = 0 or j = 0, which is a sequence length of 0, the length of the LCS is 0. Accordi
]] =K; the } the } the the intT; - intsa[3*maxn],hehe[3*MAXN],RANK[MAXN],HEIGHT[MAXN]; in intx; the Charline[3*MAXN]; the About voidDebugintN) the { the for(intI=0; i) the { +printf"sa:%d rank:%d height:%d\n", Sa[i],rank[i],height[i]); - } the }Bayi the intMain () the { - //freopen ("Input.txt", "R", stdin); -scanf"%d",T); the intAa1 =0; the while(t--) the { thescanf"%c%s",x,line); - intLen =strlen (line); the for(intI=0; iLine[i]; the
the preferences of some students respectively. NextMm rows, two integers per lineAA andB (1 \leq A, b \leq N)b(1≤a,b≤N), indicating that the student with ID a A does not want the student ID b b toprecede him (her). You can assume that the title guarantee has at least one arrangement that meets all requirements. OutputFor each set of data, the maximum score is output.Sample Input31 02 11 23 13 1Sample Output126Idea: Each time take the largest number put in front, topsort;#include #include#inclu
derived, thus deriving a collection of all the longest common subsequence .Because the problem only needs to output any one, so specify a direction backtracking.
Therefore, combining the above two algorithms can draw the final algorithm of the problem: //finding the longest common sub-sequence and losing it as a sub-sequence#include #include#includeusing namespacestd;#defineMAX 1001#defineMax (x, y) (() > (y)? ( x):(y))CharS1[max], S2[max];intMaxlen[max][max];CharAns[max];intMain () {int
POJ 1006: Biorhythms Chinese Remainder Theorem
Biorhythms
Time Limit:1000 MS
Memory Limit:10000 K
Total Submissions:121194
Accepted:38157
DescriptionSome people believe that there are three cycles in a person's life that start the day he or she is born. these three cycles are the physical, emotional, and intellectual cycles, and they have periods of lengths 23, 28, and 33 days, respectively. there is one peak in
This problem I use the method is very troublesome, use string to get the input number, and then get every character in string, stored in the array, in order to output to know the length of the array, so that the length of the array will be written in three cases.It is better to get an integer directly, with/and% to take each bit of value, so if only two bits bai= n/100; 0, direct while (bai>0) {system;bai--}; simpler. No code, too much trouble.Topic:Let us use the letter B to denote "hundred", 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.