POJ
jiang_16
一个想学好编程的弱渣妹纸,猎奇,脑洞向...
展开
-
The Suspects
Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to s原创 2017-08-15 17:26:16 · 159 阅读 · 0 评论 -
Mayor's posters 离散化+线段树染色
The 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 finally d原创 2017-09-17 16:40:52 · 185 阅读 · 0 评论 -
A Simple Problem with Integers 区间更新和查询
You 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 for the原创 2017-09-10 21:53:16 · 202 阅读 · 0 评论 -
2309 BST
Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root node is X, we can get the minimum number in this subtree by repe原创 2017-09-27 09:26:43 · 174 阅读 · 0 评论 -
Apple Tree DFS+树状数组
There 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 tree has原创 2017-09-28 19:33:05 · 530 阅读 · 0 评论 -
Seek the Name, Seek the Fame next数组的应用
The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the same time seek th原创 2017-10-09 10:21:41 · 161 阅读 · 0 评论 -
Power Strings next数组应用
Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-原创 2017-10-09 22:49:28 · 193 阅读 · 0 评论 -
Period next数组应用
For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2原创 2017-10-09 22:59:21 · 173 阅读 · 0 评论 -
Pots POJ
You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;DROP(i) empty the pot i to the原创 2017-08-01 17:17:24 · 274 阅读 · 0 评论 -
Find The Multiple POJ
Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there原创 2017-07-31 21:54:28 · 213 阅读 · 0 评论 -
Japan 逆序数
Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= 1000, N <= 10原创 2017-09-25 22:54:43 · 172 阅读 · 0 评论 -
Stars 单点修改+区间查询
Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and原创 2017-09-24 10:41:22 · 738 阅读 · 0 评论 -
Matrix 二维树状数组 区间修改+单点查询
Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 We can change the matrix in the following way. G原创 2017-09-24 16:22:21 · 452 阅读 · 0 评论 -
棋盘问题
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n 当为-1原创 2017-08-03 14:59:55 · 223 阅读 · 0 评论 -
Til the Cows Come Home
Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to get b原创 2017-08-10 09:26:07 · 165 阅读 · 0 评论 -
Frogger Dijkstra
Freddy 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 tourists' sun原创 2017-08-11 15:31:09 · 210 阅读 · 0 评论 -
Heavy Transportation Dijkstra
Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his cu原创 2017-08-11 15:41:03 · 161 阅读 · 0 评论 -
Silver Cow Party Dijkstra
One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way ro原创 2017-08-11 15:58:33 · 237 阅读 · 0 评论 -
Wormholes SPFA
While 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 time that i原创 2017-08-14 23:46:44 · 269 阅读 · 0 评论 -
Cow Contest Floyd
N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is un原创 2017-08-15 09:47:12 · 348 阅读 · 0 评论 -
Dirichlet's Theorem on Arithmetic Progressions 筛取素数
If a and d are relatively prime positive integers, the arithmetic sequence beginning witha and increasing by d, i.e., a, a + d,a + 2d, a + 3d, a + 4d, ..., contains infinitely many prime numbers.原创 2017-09-07 15:15:12 · 206 阅读 · 0 评论 -
2299 求逆序数对 归并排序/树状数组
n this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in原创 2017-09-25 09:22:27 · 200 阅读 · 0 评论 -
迷宫问题 POJ
定义一个二维数组: int maze[5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。原创 2017-08-01 16:56:52 · 192 阅读 · 0 评论