正文内容加载中...

posted @ 2011-11-06 20:00 DOF_KL 阅读 (697) 评论 (0)
编辑

摘要：problem linkhttp://codeforces.com/contest/119/problem/CA classic dp problem, even though I knew this I still spent much time on figuring out the solution.As solving most dp problem, the difficult point is to find out the state transition equation.Before working on the state transition equation, I ne 阅读全文

posted @ 2011-11-06 19:09 DOF_KL 阅读 (73) 评论 (0)
编辑

摘要：problem linkhttp://codeforces.com/contest/117/problem/DThe transformation is a recursive process.For example:L0: (1 2 3 4 5 6 7 8 9 10) D = 1 <==> 2^0L1: (1 3 5 7 9) (2 4 6 8 10) D = 2 <==> 2^1 L2: (1 5 9) (3 7) (2 6 10) (4 8) D = 4 <==> 2^2L3: (1 9) (5)... 阅读全文

posted @ 2011-10-18 19:57 DOF_KL 阅读 (162) 评论 (0)
编辑

摘要：problem linkhttp://codeforces.com/contest/117/problem/CThis problem needs to find 3-length ring in a type of graph call tournamentOne important precondition of this problem is that :Atournamentis a directed graph without self-loops in which every pair of vertexes is connected by exactly one directed 阅读全文

posted @ 2011-10-16 18:09 DOF_KL 阅读 (123) 评论 (0)
编辑

摘要：Input A B MC = 1e9The equation of p2 winning is (Na * C + Nb) % M == 0, that's (Na * (C % M) + Nb % M) % M == 0Further, p1 controls M1 = (Na * (C % M)) % M, p2 controls M2 =Nb % MIf B >= M - 1, P1 has no chances to win, because P2 can always pick a number makes (M2 + M1) % M == 0If A == B == 阅读全文

posted @ 2011-10-14 23:53 DOF_KL 阅读 (102) 评论 (0)
编辑

摘要：problem linkhttp://codeforces.com/contest/117/problem/A19:18 - 20:423 key point of this problem. a) determin which is the current floor. b) determin elevator direction c) judge the time base on the s, cf, f relationship and direction. ( s--start floor, cf--current floor, f--final floor )None of t... 阅读全文

posted @ 2011-10-13 20:46 DOF_KL 阅读 (48) 评论 (0)
编辑

摘要：problem linkhttp://codeforces.com/contest/118/problem/E17:31 The problem is easy to understand, try to transfering the undirected graph to the directed one, and mainting the strong connectivity.17:41 One clue, how to judge whether a directed graph has strong connectivity, from any vertex, there is.. 阅读全文

posted @ 2011-10-13 19:06 DOF_KL 阅读 (221) 评论 (0)
编辑

摘要：problem linkhttp://codeforces.com/contest/118/problem/D2011-10-921:38 It seems this problem is about enumeration of combination.21:42 Using DP.21:44 If I had already get F(n-1), means in total n-1 units, there are F(n-1) kinds of beautiful arrangements. suppose the beautiful arrangement is xxxxxx... 阅读全文

posted @ 2011-10-11 17:27 DOF_KL 阅读 (173) 评论 (0)
编辑

摘要：Start from the baseline number, which ranges from 0 to 9, giving a baseline number B, and digit sequence N(i) 1<=i<=n, I generate another digit sequence D(i), whose elements are B - N(i).Sorting D(i), then the first K digit can sum the minimun result of prize.But when there is equal minimun pr 阅读全文

posted @ 2011-10-09 21:30 DOF_KL 阅读 (77) 评论 (0)
编辑

摘要：It seems the problem is easy. Using 2 arrays, one to hold the original input string, and copy chars to the other according to the rules.In order to make code more tidy, I don't do all the thing within a single loop, instead, I will do the upper to lower work in the first loop, here I like the tr 阅读全文

posted @ 2011-10-09 10:11 DOF_KL 阅读 (86) 评论 (0)
编辑