自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(33)
  • 收藏
  • 关注

PKU 2516 Minimum Cost

Minimum CostTime Limit: 4000MS Memory Limit: 65536KTotal Submissions: 8593 Accepted: 2825DescriptionDearboy, a goods victualer, now comes to a big problem, and he needs...

2011-07-15 19:35:34 90

ural 1100 Final Standings

1100. Final StandingsTime Limit: 1.0 secondMemory Limit: 16 MBOld contest software uses bubble sort for generating final standings. But now, there are too many teams and that software wor...

2011-07-10 17:11:15 128

tyvj 1088 treat

[size=medium]描述 Description 给出长度为N的数列{A_i},每次可以从最左边或者最右边取走一个数,第i次取数得到的价值是i * A_j。求价值之和最大的取数方案。 输入格式 Input Format   第一行,一个整数,表示数列长度N。  接下来N行,每行一个整数,表示数列A_i。 输出格式 Output Format ...

2011-07-10 15:25:55 181

tyvj 1348 清理内奸

[size=large][align=center]清理内奸[/align][/size]描述 Description 最近FF博士在玩一个游戏“三国杀杀杀”,他扮演一个英明的主公,四处清剿反贼。终于把反贼全部干掉了,可是他的手下还存在着一些内奸。经过他的观察和研究,终于发现了内奸的重要特征。内奸最重要的工作就是传递情报,所以内奸必须掌握各种加密方法。于是他们对素数有...

2011-07-10 10:26:17 289

USACO Packing Rectangles

http://www.uwp.edu/sws/usaco/[size=medium]Packing RectanglesIOI 95 The six basic layouts of four rectangles Four rectangles are given. Find the smallest enclosing (new) rectangle into w...

2011-06-21 23:11:23 219

原创 poj3624 Charm Bracelet

DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each ...

2011-06-19 23:06:04 91

1.3 Calf Flac

[size=large][align=center]Calf Flac[/align][/size]To make the programming easier, we keep two copies of the text: the original, and one with the punctuation stripped out. We find the biggest pal...

2011-06-18 18:08:35 76

Barn Repair

[size=large][align=center]Barn Repair[/align][/size][size=medium]题目大意:有S个牛栏,其中有C头牛在里面,一些牛栏有牛,一些没有,最大有M块的板子,每块板子的长度可以任意长,用这些板子去拦住所有的牛,使它们都被围住。求最小会有多少牛栏会被围住。算法分析:isin[S]:表示第i个牛栏里是否有牛。 ...

2011-06-17 19:32:35 88

HDU 2079 选课时间

[size=large][align=center]选课时间(题目已修改,注意读题)[/align][/size][size=medium]Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1038 Accepted Submi...

2011-06-08 23:39:56 131

Ural 1017. Staircases

[size=large][align=center][color=cyan]1017. Staircases[/color][/align][/size][size=medium]Time Limit: 1.0 secondMemory Limit: 16 MBOne curious child has a set of N little bricks (5 ≤ N ≤ 500...

2011-06-06 19:39:06 90

Ural 1009. K-based Numbers

[align=center][size=x-large]1009. K-based Numbers[/size][/align]Time Limit: 1.0 secondMemory Limit: 16 MBLet’s consider K-based numbers, containing exactly N digits. We define a number to be v...

2011-06-06 15:34:17 109

1104. Don’t Ask Woman about Her Age

1104. Don’t Ask Woman about Her AgeTime Limit: 1.0 secondMemory Limit: 16 MBMrs Little likes digits most of all. Every year she tries to make the best number of the year. She tries to become m...

2011-06-06 00:09:29 154

Ural 1091. Tmutarakan Exams

1091. Tmutarakan ExamsTime Limit: 1.0 secondMemory Limit: 16 MBUniversity of New Tmutarakan trains the first-class specialists in mental arithmetic. To enter the University you should master a...

2011-06-05 23:46:42 115

Ural 1086. Cryptography

[align=center][size=large]Cryptography[/size][/align]题目大意:输入一个数n(n

2011-06-05 13:35:40 72

Ural Brave Balloonists

Ural Brave Balloonists题目大意:给定10个数ai(1

2011-06-05 12:49:57 98

11. Factorial

[align=center][size=large]Factorial[/size][/align] 这个题目已经做过N多遍了,在各大OJ上都有。 题目大意:给定一个正整数n,求n!未尾有多少个0。 算法分析:我们很容易发现阶乘未尾的0是由5产生的,即n!中有多少个5就有多少个0。从而问题就转化为求n!中分解质因数后5的系数。我们对其进行分类计数,首先求是5的倍数...

2011-06-05 10:39:21 114

5. The Next Palindrome

[size=large][align=center]The Next Palindrome[/align][/size]题目:A positive integer is called a palindrome if its representation in the decimal system is the same when read fr...

2011-06-04 21:33:18 85

SPOJ Prime Generator

SPOJ Prime Generator 题目意思:给定两个正整数m,n,(1=1; } return res;}//判断n是否是合数,如果是则返回true,否则false/*bool witness(lld a,lld n){//a^(n-1)=1 (mod n) lld u=n-1; lld t=0; while((...

2011-06-04 19:15:39 98

Friday the Thirteenth

Friday the ThirteenthIs Friday the 13th really an unusual event? That is, does the 13th of the month land on a Friday less often than on any other day of the week? To answer this question, wri...

2011-06-03 19:23:23 63

Greedy Gift Givers

Greedy Gift GiversA group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts of money. Each of these friends might or might not give some money to any or all of the other frien...

2011-06-03 18:27:12 78

Life, the Universe, and Everything

此题很水,只是第一次看到这个题目的时候有点弄不懂题意,试了一下,才发现只要遇到42就停止输入,而不是继续读入而不处理。1. Life, the Universe, and EverythingProblem code: TEST Your program is to use the brute-force approach in order to find the Answer...

2011-06-03 17:38:02 107

baby step,giant step

[url]http://en.wikipedia.org/wiki/Baby-step_giant-step[/url]

2011-06-03 16:20:15 59

一个公式的证明

我想证明的公式是:Ax≡A(x%phi(C)+phi(C)) (mod C) (x>=phi(C)) 其中phi(C)是指C的欧拉函数值,A,C,x均是正整数首先引入欧拉定理:对于任意的整数n>1,若gcd(a,n)=1,则aphi(n)≡1(mod n)由欧拉定理、鸽巢定理以及a0≡1(mod n),知ax%n是一个周期函数,且周期为phi(n)(此处就不证明了,其实...

2011-06-03 15:39:48 109

Your Ride Is Here

今天是我第一次在USACO上做题,虽然这是一个很简单很简单的题目,但是这个传说中USA培养参加IOI参赛选手的OJ,不仅让我有点向往啊。 :P 这个OJ挺让人喜欢的。我很少自己认认真真的想题,也不少的OJ上都只是过过场,最近看了不少退役大牛的博文,顿时让我感到自己是多么的可笑,让我这只井里之蛙深刻的明白自己是多么的肤浅,感受到与其它人的巨大差异,这种差异不是在目前的能力上,而是在思想意识、觉...

2011-06-03 13:08:14 73

A^B%C

1.当a,b,c都很小的时(如a,b,c

2011-05-31 21:25:10 144

Uva 10397 - Connect the Campus

题目来源:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=116&problem=1338&mosmsg=Submission+received+with+ID+8905555[/url]题目大意:见代码题目分析:见代码[code...

2011-05-31 18:12:31 67

POJ 3254 Corn Fields

Corn Fields题目来源:[url]http://poj.org/problem?id=3254[/url]题目大意:一个人买了一个N*M个方格组成的农场,有部分方格不能种植。现在需要种草给牛吃,而牛又不喜欢挨着吃(don’t share an edge–>两个方格无公共边),不种草也算一种方案,求种植方案数。此题与Mondriaan's Dream 类似,就不多...

2011-05-28 23:30:34 50

原创 poj-1204-Word Puzzles

题目大意:在一个矩阵puzzle中寻找字典中的单词,输出单词的起始位置和方向;使用trie树,叶子节点中记录方向和起始坐标,通过对每个puzzle中的字母为起始位置进行bfs即可。[code="c++"]#include #include #include using namespace std;int dx[]={-1,-1,0,1,1,1,0,-1};int d...

2011-05-28 12:22:39 101

状态压缩的动态规划

Mondriaan's Dream 题目来源:[url]http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=10710&courseid=38[/url]题目大意:给一个h*w(1

2011-05-28 11:28:23 76

HDU-1251-统计难题

trie树的最基本题型,题目是要统计在一个字典中,有多少匹配指定前缀的单词,因为trie树是一棵前缀树,所以对于trie树的每个节点在插入时只要经过这个节点便对这个计数变量加一,最后按照trie查询进行统计;返回统计量即可。[code="c++"]#include #include #include using namespace std;struct node...

2011-05-24 11:40:20 78

UVA 10048 - Audiophobia

题目大意:给定一个无向图加权图,求给定的两点间可经过的路径的最大边权最小。题目分析:这是Floyd算法的变形,设d[i][j]:表示从i到j所经过的最大权值的最小值状态转移方程:d[i][j]=min{max{d[i][k],d[k][j]},d[i][j]},利用Floyd算法改变状态转移部分的代码即可AC。[code="c++"]//Uva 10048...

2011-05-23 19:08:23 88

原创 Uva 10034 - Freckles

题目大意:给定n(0>p[i].y; memset(a,0,sizeof(a)); for(int i=0;i

2011-05-23 15:32:34 80

Uva 多源最短路问题

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=116&page=show_problem&problem=508题目大意:给定20个点,以及一些连接这些点的边,然后多次任意给定两点,求起始点到终点所经过的最少边数。题目分析:此题可以把图看作是一个所有权值均为1的带权...

2011-05-23 12:54:30 94

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除