自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Puzzles (树形dp+组合数学)

Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney’s not sure why it is

2017-07-28 13:56:52 396

翻译 Contestant Division(树形dp)

In the new ACM-ICPC Regional Contest, a special monitoring and submitting system will be set up, and students will be able to compete at their own universities. However there’s one problem. Due to the

2017-07-27 21:31:59 262

原创 God Father (树形dp 树的重心)

Last years Chicago was full of gangster fights and strange murders. The chief of the police got really tired of all these crimes, and decided to arrest the mafia leaders.Unfortunately, the structure of

2017-07-27 15:58:17 319

原创 Anniversary Party(树形dp)

Anniversary party Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8765 Accepted: 5031 DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ural State

2017-07-26 23:25:12 261

原创 Tree Cutting 树形dp

After Farmer John realized that Bessie had installed a “tree-shaped” network among his N (1 <= N <= 10,000) barns at an incredible cost, he sued Bessie to mitigate his losses. Bessie, feeling vindictiv

2017-07-26 22:47:12 318

原创 POJ 3613 Cow Relays k步最短路 (floyd + 矩阵快速幂)

Cow Relays Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7738 Accepted: 3033 DescriptionFor their physical fitness program, N (2 ≤ N ≤ 1,000,000) cows have decided to run a rel

2017-07-25 11:21:40 443

原创 POJ 3186 Treat for the Cows(区间dp)

Treats for the Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6163 Accepted: 3208 DescriptionFJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for

2017-07-23 20:49:54 277

原创 POJ 1745 Divisiblity

Divisibility Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12386 Accepted: 4421 DescriptionConsider an arbitrary sequence of integers. One can place + or - operators between

2017-07-23 19:52:32 252

原创 次小生成树模板(坑惨了)

In order to prepare the “The First National ACM School Contest” (in 20??) the major of the city decided to provide all the schools with a reliable source of power. (The major is really afraid of blac

2017-07-23 18:52:06 357

原创 HDU 1260 Tickets(DP)

TicketsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4513 Accepted Submission(s): 2320Problem Description Jesus, what a great movie! Thou

2017-07-23 10:58:46 259

原创 背包输出路径

#include #include #include #include #include #define maxn 1010using namespace std;typedef long long ll;ll v[maxn];ll w[maxn];int n,p;ll dp[maxn];int pre[maxn];int main(){ int t;

2017-07-22 21:47:15 348

原创 Bottles(选择k个物品的01背包)

Nick has n bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda ai and bottle volume bi (ai ≤ bi).Nick has decided to pour all remaining soda into m

2017-07-22 21:18:55 898

原创 FATE (完全背包)

最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当忍耐度降到0或者0以下时,xhd就不会玩这游戏。xhd还说了他最多只杀s只怪。请问他能升掉这最后一级吗? Inpu

2017-07-22 20:58:56 457

原创 Coins (多重背包)

Whuacmers use coins.They have coins of value A1,A2,A3…An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided to buy a very nice watch in a nearby shop. He wanted t

2017-07-22 20:30:17 411

原创 HDU1864 最大报销费用(01背包)

现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。 Input 测试输入包含若干测试用例。每个测试用例的第1行包含两个正数 Q 和 N,其中 Q 是给定的报销额度,N(<=30)是发票

2017-07-22 19:58:00 386

原创 Robberies(DP之01背包)

The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has decided to work in the lucrative

2017-07-22 15:26:43 341

原创 HDU 1176 免费馅饼 (DP)

免费馅饼Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 50035 Accepted Submission(s): 17341Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽

2017-07-22 01:02:43 327

原创 poj 1458 LCS(最长公共子序列)

Common Subsequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 53343 Accepted: 22124 DescriptionA subsequence of a given sequence is the given sequence with some elements

2017-07-21 23:15:37 249

原创 Sonya and A Problem without A Legend(DP+优化)

Sonya was unable to think of a story for this problem, so here comes the formal description.You are given the array containing n positive integers. At one turn you can pick any element and increase or

2017-07-21 22:40:25 494

原创 Boredom (DP)

Alex doesn’t like boredom. That’s why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers.

2017-07-21 18:55:17 569

原创 Cash Machine (多重背包)

A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bill denominations, say Dk, k=

2017-07-21 13:30:55 333

原创 HDU 1114 Piggy Bank(完全背包)

Piggy-BankTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 25594 Accepted Submission(s): 12976Problem Description Before ACM can do anything

2017-07-21 11:27:13 257

原创 POJ 1679 The Unique MST(次小生成树)

The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 30841 Accepted: 11086 DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique

2017-07-21 10:44:18 209

原创 Light OJ 1005 Rooks

1005 - Rooks PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB A rook is a piece used in the game of chess which is played on a board of square grids. A rook can

2017-07-21 08:11:43 321

原创 HDU 1087 (DP---最大递增子序列和)

Super Jumping! Jumping! Jumping!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 39083 Accepted Submission(s): 17958Problem Description Nowa

2017-07-20 22:35:05 269

原创 HDU 1069 Monkey and Banana(DP)

Monkey and BananaTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 15479 Accepted Submission(s): 8198Problem Description A group of researche

2017-07-20 22:06:11 265

原创 HDU 1257 最少导弹拦截系统(DP)

最少拦截系统Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 43044 Accepted Submission(s): 16763Problem Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种

2017-07-20 20:21:53 427

原创 HDU 1024(DP+滚动数组)

Max Sum Plus PlusTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 29920 Accepted Submission(s): 10505Problem Description Now I think you hav

2017-07-20 19:07:32 331

原创 不容易系列之一(递推+错排公式)

大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了! 做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易的道理一样。 话虽这样说,我还是要告诉大家,要想失败到一定程度也是不容易的。比如,我高中的时候,就有一个神奇的女生,在英语考试的时候,竟然把40个单项选择题全部做错了!大家都学过概率论,应该知道出现这种情况的概率,所以至今我都觉得这是

2017-07-20 15:47:59 348

原创 Tiling (递推)

In how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? Here is a sample tiling of a 2x17 rectangle. Input Input is a sequence of lines, each line containing an integer number 0 <= n <= 2

2017-07-20 13:16:41 968

原创 HDU 5015 233Matrix(矩阵快速幂+递推)

233 MatrixTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2394 Accepted Submission(s): 1389Problem Description In our daily life we often

2017-07-19 22:27:28 302

原创 POJ 3233 Matrix Power (矩阵快速幂+等比数列求和)

Matrix Power Series Time Limit: 3000MS Memory Limit: 131072K Total Submissions: 23165 Accepted: 9651 DescriptionGiven a n × n matrix A and a positive integer k, find the sum S = A + A2 +

2017-07-19 20:15:22 504

原创 Fibonacci(矩阵快速幂模板)

In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …An alternative fo

2017-07-19 16:12:46 262

原创 POJ 3249 (DAG)

Test for Job Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 11150 Accepted: 2630 DescriptionMr.Dog was fired by his company. In order to support his family, he must find a ne

2017-07-18 22:40:38 307

原创 HDU 4514 (无向图判断环及树的直径)

湫湫系列故事——设计风景线Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 5018 Accepted Submission(s): 932Problem Description   随着杭州西湖的知名度的进一步提升,园林规划专家湫

2017-07-18 21:23:06 837

原创 POJ 3468(线段树模板 Lazy)

A Simple Problem with Integers Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 111585 Accepted: 34748 Case Time Limit: 2000MS DescriptionYou have N integers, A1, A2, … , AN.

2017-07-18 16:44:05 362

原创 HDU 1142 最短路径的数量

A Walk Through the ForestTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8767 Accepted Submission(s): 3237Problem Description Jimmy experie

2017-07-18 11:52:27 692

原创 最短路——多关键字比较

给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s,终点。n和m为0时输入结束。 (1Output输出 一行有两个数, 最短距

2017-07-17 22:30:06 315

原创 POJ 3159 Candies(最短路 差分约束)

Candies Time Limit: 1500MS Memory Limit: 131072K Total Submissions: 31848 Accepted: 8896 DescriptionDuring the kindergarten days, flymouse was the monitor of his class. Occasionally the

2017-07-17 21:37:15 291

原创 邻接表构建模板

int cnt=0;struct Node{ int fr;//起点 int to;//终点 int l;//边权 int next;//指向上一条边}e[maxn*5];int head[maxn*5];//head[i]是起点为i的表头void add(int a,int b,int c){ e[cnt].fr=a; e[cnt].to

2017-07-17 20:53:06 367

空空如也

空空如也

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

TA关注的人

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