POJ
so_so_y
start to record bugs <- so hard so brave
展开
-
POJ 2553 The Bottom of a Graph(tarjan缩点)
DescriptionWe will use the following (standard) definitions from graph theory. Let V be a nonempty and finite set, its elements being called vertices (or nodes). Let E be a subset of the Cartesian p...原创 2018-04-13 13:16:08 · 157 阅读 · 0 评论 -
POJ 2828 Buy Tickets(线段树)
DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Little Cat still原创 2017-08-14 15:15:48 · 269 阅读 · 0 评论 -
POJ 3904 Sky Code(容斥)
DescriptionStancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraft. That is why he is preparing to steal the spacecraft of Petru. There is only o原创 2017-08-06 10:12:19 · 310 阅读 · 0 评论 -
POJ 2154 Color(polya+欧几里得)
DescriptionBeads of N colors are connected together into a circular necklace of N beads (N<=1000000000). Your job is to calculate how many different kinds of the necklace can be produced. You should kn原创 2017-08-04 20:01:47 · 309 阅读 · 0 评论 -
Polya定理学习总结
Burnside引理设G是N={1,2,……,n}上的置换群,G在N上可引出不同的等价类,其中不同的等价类的个数为1|G|∑g∈G\frac{1}{|G|}\sum_{g∈G}c1(g),其中,c1(g)是置换g中不边缘的个数,即g中1阶循环的个数。理解后续补更……polya定理设G={a1,a2,a3,……,ag}是n个对象的置换群,用m种颜色给这n个对象染色,不同的着色方案为:1|G|{mc(a原创 2017-08-04 18:44:07 · 698 阅读 · 0 评论 -
POJ 2409 Let it Bead(polya染色问题)
Description“Let it Bead” company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department found out that customers a原创 2017-08-04 19:57:07 · 474 阅读 · 0 评论 -
POJ 1286 Necklace of Beads(Polya染色问题)
DescriptionBeads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation around the center of the circular n原创 2017-08-04 18:56:32 · 425 阅读 · 0 评论 -
POJ 1679 The Unique MST(次小生成树之一)
DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a su原创 2017-08-19 10:41:01 · 271 阅读 · 0 评论 -
POJ 1026 Cipher(置换)
DescriptionBob and Alice started to use a brand-new encoding scheme. Surprisingly it is not a Public Key Cryptosystem, but their encoding and decoding is based on secret keys. They chose the secret key原创 2017-08-04 20:52:03 · 295 阅读 · 0 评论 -
POJ 3270 Cow Sorting(置换)
DescriptionFarmer John’s N (1 ≤ N ≤ 10,000) cows are lined up to be milked in the evening. Each cow has a unique “grumpiness” level in the range 1…100,000. Since grumpy cows are more likely to damage F原创 2017-08-04 20:25:57 · 302 阅读 · 0 评论 -
欧拉函数学习笔记整理 POJ 2407+POJ 1284+POJ 2478+POJ 3090
定义欧拉函数φ(x)代表1-x中与x互质的数的个数。基本相关性质1.设x=a1p1∗a2p2∗...∗anpnx=a1p1∗a2p2∗...∗anpnx={a1}^{p1}*{a2}^{p2}*...*{an}^{pn} 则φ(x)=x∗(1−1a1)∗(1−1a2)∗...∗(1−1an)x∗(1−1a1)∗(1−1a2)∗...∗(1−1an)x*(1-\frac{1}{a1...原创 2017-04-27 19:18:11 · 607 阅读 · 0 评论 -
高斯消元学习总结
算法目的主要是用来求解线性方程组,根据方程组得出增广矩阵,对增广矩阵进行化简可得矩阵的秩,并可以根据秩的关系判断方程解的情况。算法主要思想1、线性代数中有关矩阵的化简(主要是初等行变换): 先根据矩阵初等行变换求解方程组 2x+y+z=16x+2y+z=−1−2x+2y+z=72x+y+z=1\\6x+2y+z=-1\\-2x+2y+z=7 先根据方程组表示出增广矩阵,化简 ⎡⎣⎢⎢26−2原创 2017-07-31 13:47:44 · 2305 阅读 · 0 评论 -
POJ 2558 Mayor's posters(线段树+离散化+区间更新)
DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has原创 2017-08-14 09:44:05 · 273 阅读 · 0 评论 -
POJ 2777 Count Color(线段树+懒惰标记)
DescriptionChosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem. There is a very long board with length L centime原创 2017-08-14 20:35:17 · 325 阅读 · 0 评论 -
POJ 3259 Wormholes(最短路)
DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a t原创 2017-03-01 11:24:51 · 463 阅读 · 0 评论 -
POJ 1384 Piggy-Bank(完全背包)
DescriptionBefore ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The idea beh...原创 2018-02-15 16:06:03 · 225 阅读 · 0 评论 -
贪心四部曲
NYOJ71 独木舟上的旅行问题描述 n个人乘船,要求在独木舟最大承载量w内求出需安置的最少的独木舟数,限制每条船最多乘坐两人。 问题分析 在整体中首先需要考虑体重最轻的一个人,如果没有人可以与他一起同坐一艘船,则必须每个人独自乘坐;不然根据贪心的策略,应在能 和他一起乘船的人中选择最重的那一个人与他一起乘船。代码实现#include <iostream>...原创 2017-01-27 18:03:42 · 517 阅读 · 1 评论 -
POJ 3254 Corn Fields(状压DP)
DescriptionFarmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares.原创 2017-09-02 22:39:10 · 215 阅读 · 0 评论 -
POJ 3468 A Simple Problem with Integers(线段树区间更新+区间求和)
DescriptionYou have N integers, A1, A2, … , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask原创 2017-11-19 18:01:46 · 194 阅读 · 0 评论 -
扩展欧几里得学习总结
扩展欧几里得算法用来在已知整数a,b的情况下求解符合条件的x,y值,满足等式ax+by=gcd(a,b)。 且有对于整数 a,b, 必然存在整数对 x,y,满足ax+by=gcd(a,b)。有关公式的递归关系由欧几里得算法可知求解两个整数gcd的过程,即gcd(a,b)=gcd(b,a%b)。那么当辗转到最终状态时b=0,a=gcd,此时对于ax+by=gcd(a,b)对应着x=1,y=0,即a*原创 2017-08-02 19:38:57 · 410 阅读 · 0 评论 -
POJ 3411 Paid Roads(dfs技巧)
DescriptionA network of m roads connects N cities (numbered from 1 to N). There may be more than one road connecting one city with another. Some of the roads are paid. There are two ways to pay for tra原创 2017-10-05 10:02:46 · 374 阅读 · 0 评论 -
POJ 1330 Nearest Common Ancestors(LCA)
DescriptionA rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with an integer from {1, 2,…,16}. Node 8原创 2017-10-01 18:43:50 · 191 阅读 · 0 评论 -
POJ 2923 Relocation(状压DP+01背包)
DescriptionEmma and Eric are moving to their new house they bought after returning from their honeymoon. Fortunately, they have a few friends helping them relocate. To move the furniture, they only hav原创 2017-09-05 11:17:05 · 229 阅读 · 0 评论 -
POJ 2955 Brackets & POJ 1505 Copying Books & POJ 1651 Multiplication Puzzle(初级区间DP)
POJ 2955 Brackets题目大意在给定字符串中有多少个可匹配括号,()和[]为可匹配。解题思路dp[i][j]代表i~j有多少个可匹配的字符串。 转移方程: 1、dp[i][j]=dp[i+1][j-1]+2,当i,j位置组成可匹配括号; 2、枚举分割点k (i<=k<j)(i<=k<j) :dp[i][j]=max(dp[i][j],dp[i][k]+dp[k+1][j])代码实原创 2017-08-26 21:35:52 · 245 阅读 · 0 评论 -
POJ 3026 Borg Maze(最小生成树)
DescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civil原创 2017-03-08 11:17:36 · 352 阅读 · 0 评论 -
POJ 1789 Truck History(最小生成树)
DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing each ty原创 2017-03-08 11:01:23 · 305 阅读 · 0 评论 -
POJ 1195 Mobile phones(二维树状数组)
DescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix with the rows and col原创 2017-08-11 17:48:05 · 281 阅读 · 0 评论 -
POJ 3321 Apple Tree(树状数组+DFS构建)
DescriptionThere is an apple tree outside of kaka’s house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree.The tre原创 2017-08-11 15:39:43 · 470 阅读 · 0 评论 -
组合数学 POJ 1019 Number Sequence
DescriptionA single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2…Sk. Each group Sk consists of a sequence of positive i原创 2017-02-03 21:00:33 · 383 阅读 · 0 评论 -
组合数学 POJ 1942 Paths on a Grid
DescriptionImagine you are attending your math lesson at school. Once again, you are bored because your teacher tells things that you already mastered years ago (this time he’s explaining that (a+b)2=a原创 2017-02-03 21:36:46 · 354 阅读 · 0 评论 -
POJ 2253 Frogger(最短路)
DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tou原创 2017-03-01 19:05:06 · 331 阅读 · 0 评论 -
POJ 1062 昂贵的聘礼(最短路)
Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:”嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。”探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者原创 2017-03-01 12:09:54 · 575 阅读 · 0 评论 -
POJ 1860 Currency Exchange(最短路)
DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies.原创 2017-03-01 10:46:02 · 497 阅读 · 0 评论 -
POJ 1125 Stockbroker Grapevine(最短路)
DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in t原创 2017-03-01 19:35:49 · 427 阅读 · 0 评论 -
POJ 2240 Arbitrage(最短路)
DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys原创 2017-03-01 19:56:17 · 361 阅读 · 0 评论 -
POJ 2485 Highways (水题入门最小生成树)
DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this problem. T原创 2017-03-08 13:42:31 · 607 阅读 · 0 评论 -
两次入坑逆向拓扑序(POJ 3687 Labeling Balls and HDU 4857 逃生)
第一次跳坑POJ 3687 Labeling BallsDescriptionWindy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that:No two balls share the same label. The l原创 2017-03-14 13:34:51 · 395 阅读 · 0 评论 -
POJ 2251 Dungeon Master(广搜)
DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit no原创 2017-03-15 10:48:03 · 307 阅读 · 0 评论 -
POJ 3009 Curling 2.0(深搜)
DescriptionOn Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square me原创 2017-03-15 11:11:44 · 386 阅读 · 0 评论 -
组合数学 POJ 1850 Code
DescriptionTransmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a number is associated原创 2017-02-03 20:14:39 · 430 阅读 · 0 评论