- 博客(33)
- 资源 (2)
- 收藏
- 关注
原创 POJ Face The Right Way(尺取法+贪心)
DescriptionFarmer John has arranged his N (1 ≤ N ≤ 5,000) cows in a row and many of them are facing forward, like good cows. Some of them are facing backward, though, and he needs them all to face f
2016-04-30 00:41:43 1095
原创 POJ 2785 4 Values whose Sum is 0(排序+二分搜索)
DescriptionThe SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d = 0 . In
2016-04-29 10:54:16 459
原创 POJ 3320 Jessica Reading Problem(尺取法)
DescriptionJessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on it. If she wants to pass it, she has to master a
2016-04-28 00:08:01 425
原创 POJ 3061 Subsequence (二分查找)
DescriptionA sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal leng
2016-04-27 16:26:34 389
原创 POJ 3723Conscription
DescriptionWindy has a country, and he wants to build an army to protect his country. He has picked up N girls and M boys and wants to collect them to be his soldiers. To collect a soldier without a
2016-04-26 12:59:45 476
原创 POJ 3255Roadblocks
DescriptionBessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she likes the scenery along
2016-04-25 20:09:46 320
原创 POJ 2456Aggressive cows
DescriptionFarmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000,000,000).His C (2 <=
2016-04-25 11:24:08 306
原创 UVa 10006 - Carmichael Numbers
连接网址:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=947这一题的用到快速幂的求法:代码如下AC代码:# include # include using namespace std;typedef lo
2016-04-21 20:50:20 410
原创 POJ1182 食物链
Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物
2016-04-20 18:25:03 411
原创 POJ 2431 Expedition
DescriptionA group of cows grabbed a truck and ventured on an expedition deep into the jungle. Being rather poor drivers, the cows unfortunately managed to run over a rock and puncture the truck's
2016-04-18 21:55:15 478
原创 NYOJ 176 整数划分(二)
整数划分(二)时间限制:1000 ms | 内存限制:65535 KB难度:3描述把一个正整数m分成n个正整数的和,有多少种分法?例:把5分成3个正正数的和,有两种分法:1 1 31 2 2输入第一行是一个整数T表示共有T组测试数据(T每组测试数据都是两个正整数m,n,其中(1输出输出拆分的方法的数目。样例输入25 2
2016-04-18 15:55:06 540
原创 NYOJ 整数划分
整数划分时间限制:3000 ms | 内存限制:65535 KB难度:3描述将正整数n表示成一系列正整数之和:n=n1+n2+…+nk, 其中n1≥n2≥…≥nk≥1,k≥1。 正整数n的这种表示称为正整数n的划分。求正整数n的不 同划分个数。 例如正整数6有如下11种不同的划分: 6; 5+1; 4+2,4+1+1; 3+3,3+2+1,3+1+1
2016-04-18 13:56:11 425
原创 POJ 3253Fence Repair
DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer len
2016-04-17 16:55:47 305
原创 POJ 3069Saruman Army
DescriptionSaruman the White must lead his army along a straight path from Isengard to Helm’s Deep. To keep track of his forces, Saruman distributes seeing stones, known as palantirs, among the tr
2016-04-17 16:35:21 367
原创 POJ 3617Best Cow Line
DescriptionFJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his cows in a line and herds them past the judges.
2016-04-17 15:15:30 336
原创 POJ Lake Counting
DescriptionDue to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains
2016-04-17 14:12:27 338
原创 HDU u Calculate e
Problem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.
2016-04-17 12:32:05 463 1
原创 FOJ Problem 2221 RunningMan
Problem DescriptionZB loves watching RunningMan! There's a game in RunningMan called 100 vs 100.There are two teams, each of many people. There are 3 rounds of fighting, in each round the two te
2016-04-14 16:35:35 858
原创 FOJ Problem 2218 Simple String Problem
Problem DescriptionRecently, you have found your interest in string theory. Here is an interesting question about strings.You are given a string S of length n consisting of the first k lowercase
2016-04-13 22:44:57 772
原创 FOJ Problem 2216 The Longest Straight
Problem DescriptionZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(including 1 and M). A straight is a sequence of cards with consec
2016-04-12 16:25:21 591
原创 FOJ Problem 2214 Knapsack problem
Problem DescriptionGiven a set of n items, each with a weight w[i] and a value v[i], determine a way to choose the items into a knapsack so that the total weight is less than or equal to a given lim
2016-04-11 16:07:48 514
原创 FOJ Common Tangents
Problem DescriptionTwo different circles can have at most four common tangents.The picture below is an illustration of two circles with four common tangents.Now given the center and radius o
2016-04-10 09:48:19 320
原创 FOJ A Super Mobile Charger
Problem DescriptionWhile HIT ACM Group finished their contest in Shanghai and is heading back Harbin, their train was delayed due to the heavy snow. Their mobile phones are all running out of batter
2016-04-10 09:20:35 343
原创 NYOJ Cut the rope
Cut the rope时间限制:1000ms | 内存限制:65535KB难度:4描述We have a rope whose length is L. We will cut the rope into two or more parts, the length of each part must be an integer, and
2016-04-10 01:07:25 1269
原创 openjudge 4079:二叉搜索树
4079:二叉搜索树查看 提交 统计 提示 提问总时间限制: 1000ms 内存限制: 1024kB描述二叉搜索树在动态查表中有特别的用处,一个无序序列可以通过构造一棵二叉搜索树变成一个有序序列,构造树的过程即为对无序序列进行排序的过程。每次插入的新的结点都是二叉搜索树上新的叶子结点,在进行插入操作时,不必移动其它结点,只需改动某个结点的指针,由空变为非空即可。这里,我们想
2016-04-08 23:10:56 1209
原创 NYOJ 又见拦截导弹
又见拦截导弹时间限制:3000ms | 内存限制:65535KB难度:3描述大家对拦截导弹那个题目应该比较熟悉了,我再叙述一下题意:某国为了防御敌国的导弹袭击,新研制出来一种导弹拦截系统。但是这种导弹拦截系统有一个缺陷:它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度。突然有一天,雷达捕捉到敌国的导弹来袭。由于该系统存在缺陷
2016-04-08 21:18:37 464
原创 openjudge 4077出栈序列统计
4077:出栈序列统计查看提交统计提示提问总时间限制:100ms内存限制:64kB描述栈是常用的一种数据结构,有n个元素在栈顶端一侧等待进栈,栈顶端另一侧是出栈序列。你已经知道栈的操作有两种:push和pop,前者是将一个元素进栈,后者是将栈顶元素弹出。现在要使用这两种操作,由一个操作序列可以得到一系列的输出序列。请你编程求出对于给定的n,计算并输
2016-04-05 19:00:04 885
原创 HDU 1116 Play on Words
Problem DescriptionSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, th
2016-04-05 14:06:15 814
原创 NYOJ 737石子合并(一)
石子合并(一)时间限制:1000ms | 内存限制:65535KB难度:3描述有N堆石子排成一排,每堆石子有一定的数量。现要将N堆石子并成为一堆。合并的过程只能每次将相邻的两堆石子堆成一堆,每次合并花费的代价为这两堆石子的和,经过N-1次合并后成为一堆。求出总的代价最小值。输入有多组测试数据,输入到文件结束。每组测试数据第一行有一个整
2016-04-03 19:33:24 427
原创 NYOJ 最大和
最大和时间限制:1000ms | 内存限制:65535KB难度:5描述给定一个由整数组成二维矩阵(r*c),现在需要找出它的一个子矩阵,使得这个子矩阵内的所有元素之和最大,并把这个子矩阵称为最大子矩阵。例子:0 -2 -7 09 2 -6 2-4 1 -4 1-1 8 0 -2其最大子矩阵为:9
2016-04-02 23:18:30 511
原创 NYOJ 求逆序数
求逆序数时间限制:2000ms | 内存限制:65535KB难度:5描述在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。现在,给你一个N个元素的序列,请你判断出它的逆序数是多少。比如 1 3 2 的逆序数就是1。输入第一行输入一个
2016-04-02 22:34:29 486
原创 NYOJ 迷宫寻宝(一)
迷宫寻宝(一)时间限制:1000 ms | 内存限制:65535 KB难度:4描述一个叫ACM的寻宝者找到了一个藏宝图,它根据藏宝图找到了一个迷宫,这是一个很特别的迷宫,迷宫里有N个编过号的门(N输入输入可能会有多组测试数据(不超过10组)。每组测试数据的第一行包含了两个整数M,N(1.表示可以走的路S:表示ACM的出发点G表示宝藏的位置X表
2016-04-02 18:30:48 1087
原创 百练openjudge 1050:To the Max
1050:To the Max查看 提交 统计 提示 提问总时间限制: 5000ms 内存限制: 65536kB描述Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater lo
2016-04-01 00:14:21 392
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人