- 博客(347)
- 收藏
- 关注
原创 ZOJ 3868 GCD Expectation 莫比乌斯反演
GCD ExpectationTime Limit: 4 Seconds Memory Limit: 262144 KBEdward has a set of n integers {a1, a2,…,an}. He randomly picks a nonempty subset {x1, x2,…,xm} (each nonempty subset has equal probability t
2015-04-16 14:10:09 809
原创 ZOJ 3863 Paths on the Tree 树分治
Paths on the TreeTime Limit: 6 Seconds Memory Limit: 131072 KBEdward has a tree with n vertices conveniently labeled with 1,2,…,n.Edward finds a pair of paths on the tree which share no more than
2015-04-16 13:52:37 1043
原创 UVA 10808 - Rational Resistors 高斯消元
Problem ?Rational ResistorsTime Limit: 15 seconds"Resistance will be punished.Cooperation will be rewarded."J. Michael Straczynski, "Babylon 5" and "Jeremiah".Given a network
2015-02-15 22:03:22 624
原创 UVA 716 - Commedia dell' arte 逆序数
Commedia dell' arte So called commedia dell' arte is a theater genre firstplayed at Italy in the beginning of the sixteenth century. It was inspiredwith the Roman Theater. The play had n
2015-02-11 15:02:46 719
原创 UVA 1016 - Silly Sort
题目:http://uva.onlinejudge.org/external/10/1016.pdf题意:就是将一个排列通过不断的交换两个数的位置,使得排列变成{1,2,3,4.....n}交换两个数的cost是交换的两个数的和。思路:首先,我们能得到一个排列。然后根据置换得到一个一个的环。在每个环内,因为最小的数肯定不再自己的位置上,那么我们把那个最小数的位置应该放的
2015-02-11 12:31:00 590
原创 UVA 11255 - Necklace (等价置换)
Problem C - NecklaceOnce upon a time, three girls - Winnie, Grace and Bonnie - owned a large number of pearls. However, each of them only had a single color of pearls. Winnie had white pearls,
2015-02-08 23:43:52 540
原创 UVA 11176 - Winning Streak
Problem BWinning StreakInput: Standard InputOutput: Standard Output "You can run on for a long time,sooner or later God'll cut you down."– Traditional folk songMikael likes to gamble,
2015-01-27 20:58:34 506
原创 UVA 11971 Polygon
U — PolygonTime Limit: 1 secMemory Limit: 32 MBJohn has been given a segment of lenght N, however he needs a polygon. In order to create a polygon he has cut given segment K times at rand
2015-01-27 17:53:08 455
原创 UVA 10417 - Gift Exchanging
#include #include #include #include #include #include #include #include #include #include #include using namespace std;#define rep(i,a,b) for(int i=(a);i<(int)(b);++i)#define rrep(i
2015-01-27 15:24:31 537
原创 UVA 11605 - Lights inside a 3d Grid 概率
思路:我们只需要算出每个cell在K次turn之后,状态是ON的概率就行了。在一次turn中一个cell被翻转的概率是多少呢?假设这个cell的坐标是(x,y,z),那么被翻转的概率就是 (x + 1) * (N - x) * (y + 1) * (M - y) * (z + 1) * (P - 1)/ (N * N * M * M * P * P) , 然后K次中只要是有奇数次翻转,最后就是ON
2015-01-27 13:30:49 486
原创 UVA 11133 - Eigensequence
Problem E: EigensequenceGiven an increasing sequence of integers a1, a2, a3, ..., ak, the E-transform produces a sequence of the same length, b1, b2, b3, ..., bk such thatb1 = a1for j>1, bj
2015-01-09 16:29:37 467
原创 UVA 766 Sum of powers
Sum of powers A young schoolboy would like to calculate the sum for some fixed natural k and different natural n. He observed that calculating ik for all i ( ) and summing
2014-12-29 00:50:18 583
原创 UVA 10844 - Bloques bell数
Problem EBloquesTime Limit: 2 secondsLittle Joan has N blocks,all of them of different sizes. He is playing to build cities in the beach. A city is just a collection of buildings.A single
2014-12-28 22:55:19 507
原创 UVA 10843 - Anne's game
Problem DAnne's gameTime Limit: 2 secondsLily: "Chantarelle was part of my exotic phase."Buffy: "It's nice. It's a mushroom."Lily: "It is? That's really embarrassing."Buffy: "Wel
2014-12-28 20:00:49 760
原创 UVA 10593 - Kites
Problem EKitesTime Limit4 Seconds The season of flying kites is well ahead. So what? Let us make an inventory for kites. We are given a square shaped sheet of paper.
2014-12-28 19:48:42 481
原创 UVA 10581 Partitioning for fun and profit
Problem A: Partitioning for fun and profitA partition of a positive integer number m into nelements (n ≤ m) is a sequence of positive numbersa1,...,an such that a1+...+an = m anda1 ≤ a2 ≤ ...
2014-12-28 15:33:18 431
原创 10574 - Counting Rectangles
Problem HCounting RectanglesInput: Standard InputOutput: Standard OutputTime Limit: 3 Seconds Given n points on the XY plane, count how many regular rectangles are formed. A rectangle is r
2014-12-28 14:36:40 585
原创 UVA 12034 Race
Race Disky and Sooma, two of the biggest mega minds of Bangladesh went to a far country. They ate, coded and wandered around, even in their holidays. They passed several months in this way
2014-12-28 13:10:12 482
原创 UVA 11421 - Arranging Cards
Problem EArranging CardsInput: Standard InputOutput: Standard Output Given n (n Each card is represented by two characters: its rank (2~9,T for ten,J for Jack,Q for Queen,K for King,A f
2014-12-27 22:00:09 569
原创 UVA 10712 - Count the Numbers 容斥
Problem HCount the NumbersInput: standard inputOutput: standard outputTime Limit: 2 seconds You're given three non-negative integers N (0 , A, B, (0 . Count the number of integers in the i
2014-12-26 17:47:19 524
原创 UVA 10623 Thinking Backward 欧拉公式
Problem AThinking BackwardInput: Standard InputOutput: Standard OutputTime Limit: 2 Seconds Plane division by a common shape is a very well known topic of computer science. The pictures b
2014-12-25 23:57:59 528
原创 UVA 10458 Cricket Ranking (容斥)
Problem FCricket RankingInput: standard inputOutput: standard outputTime Limit: 2 seconds World Cup Cricket 2003 is now going on in South Africa. The final will be held on 23rd March in Jo
2014-12-24 21:16:08 473
原创 UVA 10237 Bishops
Problem BBishopsInput: standard inputOutput: standard outputTime Limit: 4 secondsMemory Limit: 32 MB A bishop is a piece used in the game of chess which is played on a board of squar
2014-12-22 23:47:35 611
原创 UVA 11481 Arrange the Numbers (容斥)
思路:我们能用容斥来做的...代码很短,具体可以看代码。代码:#include #include #include #include #include #include #include #include #define rep(i,a,b) for(int i=(a);i<(b);++i)#define rrep(i,b,a) for(int i = (b);
2014-12-22 18:14:13 388
原创 UVA 1436 Counting heaps (树形dp)
We are given a rooted tree of n vertices. The vertices are to be labeled with numbers 1, 2,..., n so that each label is unique and the heap condition holds, i.e. the label of any vertex is less than
2014-12-22 17:32:28 656
原创 UVA 12123 Magnetic Train Tracks
The rail roads of Japan are being redesigned. So the governent is planning to install ultra-modern Magnetic trains instead of the current normal trains. As fuel price have gone high and nations have s
2014-12-22 02:11:13 576
原创 UVA 11529 Strange Tax Calculation
思路:我们算每个点在多少个三角形内就行了.....我们枚举每个点为原点,然后统计有多少个三角形包含这个原点。统计的话,我们按照极角排序,当确定了两个点的时候,可以马上知道第三个点的区间,画个图就知道了.....当然直接这样枚举两个点的话单个点的复杂度就是n^2,这样显然不行嘛。。。其实这里我们可以降低一维的....用前缀和之类的搞搞它就行了。代码:#include #includ
2014-12-21 23:10:07 397
原创 UVA 12075 Counting Triangles
Triangles are polygons with three sides and strictly positive area. Lattice triangles are the triangles all whose vertexes have integer coordinates. In this problem you have to find the number of latt
2014-12-21 21:40:37 483
原创 UVA 1393 - Highways
Hackerland is a happy democratic country with m×n cities, arranged in a rectangular m by n grid and connected by m roads in the east-west direction and n roads in the north-south direction. By publi
2014-12-21 16:28:43 417
原创 HDU 4801 Pocket Cube bfs
Pocket CubeTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 816 Accepted Submission(s): 255Problem DescriptionPocket Cube is
2014-12-11 23:23:36 516
原创 HDU 4800 Josephina and RPG DP
Josephina and RPGTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1030 Accepted Submission(s): 303Special JudgeProblem Description
2014-12-11 23:21:01 467
原创 HDU 4799 LIKE vs CANDLE 树形dp
LIKE vs CANDLETime Limit: 4000/2000 MS (Java/Others) Memory Limit: 327680/327680 K (Java/Others)Total Submission(s): 242 Accepted Submission(s): 53Problem DescriptionA microblog
2014-12-11 23:17:49 594
原创 HDU 4798 Skycity
SkycityTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 355 Accepted Submission(s): 92Problem DescriptionThe world's new talle
2014-12-11 23:10:58 576
原创 HDU 4797 Graph Reconstruction
Graph ReconstructionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 280 Accepted Submission(s): 0Problem DescriptionLet there
2014-12-11 23:03:00 1040
原创 HDU 4796 Winter's Coming 插头DP
Winter's ComingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 55 Accepted Submission(s): 9Problem Description″You are too yo
2014-12-11 22:51:02 1296
原创 HDU 4794 Arnold 斐波那契数列循环节
ArnoldTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 182 Accepted Submission(s): 33Problem DescriptionDo you know Vladimir
2014-12-11 21:48:54 2261 2
原创 HDU 4793 Collision
【科普】什么是BestCoder?如何参加?CollisionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 459 Accepted Submission(s): 180Special Judge
2014-12-11 21:23:04 498
原创 HDU 4791 Alice's Print Service
Alice's Print ServiceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1426 Accepted Submission(s): 341Problem DescriptionAlice
2014-12-11 21:14:54 379
原创 ZOJ 3825 Garden and Sprinklers 扩展欧几里得
Garden and SprinklersTime Limit: 2 Seconds Memory Limit: 65536 KBThere is a beautiful garden in Marjar University. Recently, Edward, the headmaster of Marjar University, decided to build
2014-12-03 17:57:09 1061
原创 ZOJ 3826 Hierarchical Notation 模拟
Hierarchical NotationTime Limit: 2 Seconds Memory Limit: 131072 KBIn Marjar University, students in College of Computer Science will learn EON (Edward Object Notation), which is a hiera
2014-12-01 15:38:14 515
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人