ACM_日常
文章平均质量分 81
YzlCoder
未曾有过远大的梦想,只想用双手敲写明天
展开
-
C语言动态规划(2)___Maximum sum
DescriptionGiven a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below:Your task is to calculate d(A).InputThe input consists of T(Each test case co原创 2014-11-12 19:41:23 · 1265 阅读 · 0 评论 -
C语言动态规划(3)___Filthy Rich(Hdu 2391)
Problem DescriptionThey say that in Phrygia, the streets are paved with gold. You’re currently on vacation in Phrygia, and to your astonishment you discover that this is to be taken literally: sma原创 2014-12-22 19:02:43 · 1065 阅读 · 0 评论 -
C语言动态规划(5)___FATE(Hdu 2159)
Problem Description最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当忍耐度降到0或者0以下时,xhd就不会玩这游戏。xhd还说了他最多只原创 2014-12-23 23:11:54 · 1021 阅读 · 0 评论 -
C语言动态规划(7)___过河(Vijos P1002)
Problem Description在河上有一座独木桥,一只青蛙想沿着独木桥从河的一侧跳到另一侧。在桥上有一些石子,青蛙很讨厌踩在这些石子上。由于桥的长度和青蛙一次跳过的距离都是正整数,我们可以把独木桥上青蛙可能到达的点看成数轴上的一串整点:0,1,……,L(其中L是桥的长度)。坐标为0的点表示桥的起点,坐标为L的点表示桥的终点。青蛙从桥的起点开始,不停的向终点方向跳跃。一次跳跃原创 2015-01-02 19:36:10 · 3759 阅读 · 1 评论 -
C语言动态规划(10)___Doing Homework(HDU 1074)
DescriptionIgnatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the ho原创 2015-03-19 19:41:17 · 1033 阅读 · 0 评论 -
C语言动态规划(8)___雇佣工人(HDU 1158)
Problem DescriptionA project manager wants to determine the number of the workers needed in every month. He does know the minimal number of the workers needed in each month. When he hires or fires原创 2015-03-04 18:36:15 · 1315 阅读 · 1 评论 -
C语言动态规划(1)___Bridging signals
Description'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the signals on the chip conn原创 2014-11-12 15:22:47 · 877 阅读 · 0 评论 -
C语言动态规划(11)___免费馅饼
Problem Description都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个原创 2015-03-20 14:37:20 · 1413 阅读 · 0 评论 -
C语言动态规划(9)___消去游戏(FZU 2126)
Problem DescriptionS最近在玩一种游戏。这种游戏的规则是一个一个地往一个栈里放有颜色的球,当栈顶连续k个球颜色相同时,这k个球立刻同时消失。现在S已经往栈里放了n个球,他想知道再放m个球,然后使得栈里的球都被消去的放法有多少种。两种放法不同是指存在放的第i个球这两种放法放的球的颜色不同。由于方法数可能很多,将答案mod 1000000007。 Input输入包原创 2015-03-09 19:12:24 · 1193 阅读 · 0 评论 -
C语言动态规划(6)___传纸条(Vijos P1493)
描述:小渊和小轩是好朋友也是同班同学,他们在一起总有谈不完的话题。一次素质拓展活动中,班上同学安排做成一个m行n列的矩阵,而小渊和小轩被安排在矩阵对角线的两端,因此,他们就无法直接交谈了。幸运的是,他们可以通过传纸条来进行交流。纸条要经由许多同学传到对方手里,小渊坐在矩阵的左上角,坐标(1,1),小轩坐在矩阵的右下角,坐标(m,n)。从小渊传到小轩的纸条只可以向下或者向右传递,从小轩传原创 2014-12-29 16:56:36 · 2798 阅读 · 0 评论 -
语言动态规划(12)___跑跑卡丁车(HDU 1494)
Problem Description跑跑卡丁车是时下一款流行的网络休闲游戏,你可以在这虚拟的世界里体验驾驶的乐趣。这款游戏的特别之处是你可以通过漂移来获得一种加速卡,用这种加速卡可以在有限的时间里提高你的速度。为了使问题简单化,我们假设一个赛道分为L段,并且给你通过每段赛道的普通耗时Ai和用加速卡的耗时Bi。加速卡的获得机制是:普通行驶的情况下,每通过1段赛道,可以获得20%的能量(原创 2016-05-11 17:54:24 · 2889 阅读 · 1 评论 -
状压Dp_______Sitting in Line( hdu 5691 2016百度之星初赛A )
Problem Description度度熊是他同时代中最伟大的数学家,一切数字都要听命于他。现在,又到了度度熊和他的数字仆人们玩排排坐游戏的时候了。游戏的规则十分简单,参与游戏的N个整数将会做成一排,他们将通过不断交换自己的位置,最终达到所有相邻两数乘积的和最大的目的,参与游戏的数字有整数也有负数。度度熊为了在他的数字仆人面前展现他的权威,他规定某些数字只能在坐固定的位置上,没有被度度熊原创 2016-06-10 16:20:26 · 721 阅读 · 0 评论 -
Manacher______ztr loves substring(hdu 5677 BestCoder Round #82)
问题描述ztr喜欢研究子串,今天,他有n个串现在ztr想知道,能否从这n个串的所有回文子串中,取出恰好k个回文串且满足这些回文串的长度之和为L以yjqqaq为例这个串包含的回文子串有y,j,q,a,q,qq,qaq所以我们可以既选qq,又选qaq输入描述有T组数据,第一行为一个正整数T(TT(T=10)每组数据第一行为三个正整数N(1N(1=N=100),K(1=K=原创 2016-07-10 11:21:09 · 609 阅读 · 1 评论 -
树形dp____Magic boy Bi Luo with his excited tree( hdu 5834 2016ccpc网络赛)
Problem DescriptionBi Luo is a magic boy, he also has a migic tree, the tree has N nodes , in each node , there is a treasure, it's value is V[i], and for each edge, there is a cost C[i], wh原创 2016-08-16 01:37:43 · 813 阅读 · 0 评论 -
概率DP_____ATM Mechine( hdu 5781 2016多校第五场)
Problem DescriptionAlice is going to take all her savings out of the ATM(Automatic Teller Machine). Alice forget how many deposit she has, and this strange ATM doesn't support query deposit. The o原创 2016-08-28 19:26:05 · 842 阅读 · 0 评论 -
树形DP______Bribing FIPA( POJ 3345 )
DescriptionThere is going to be a voting at FIPA (Fédération Internationale de Programmation Association) to determine the host of the next IPWC (International Programming World Cup). Benjamin Ben原创 2016-08-20 14:49:12 · 503 阅读 · 0 评论 -
树形DP_______Strategic game( POJ 1463 )
DescriptionBob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sad. Now he has the following problem. He must d原创 2016-08-20 23:54:50 · 444 阅读 · 0 评论 -
树形DP_____Party at Hali-Bula( POJ 3342 )
DescriptionDear Contestant,I'm going to have a party at my villa at Hali-Bula to celebrate my retirement from BCM. I wish I could invite all my co-workers, but imagine how an employee can enjoy原创 2016-08-21 02:08:35 · 564 阅读 · 0 评论 -
树形DP______Rebuilding Roads( POJ 1947 )
DescriptionThe cows have reconstructed Farmer John's farm, with its N barns (1 <= N <= 150, number 1..N) after the terrible earthquake last May. The cows didn't have time to rebuild any extra road原创 2016-08-21 13:28:15 · 443 阅读 · 0 评论 -
树形DP_______Anniversary party( POJ 2342 )
DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor rela原创 2016-08-21 23:00:38 · 525 阅读 · 0 评论 -
树形DP______Apple Tree( POJ 2486 )
DescriptionWshxzt is a lovely girl. She likes apple very much. One day HX takes her to an apple tree. There are N nodes in the tree. Each node has an amount of apples. Wshxzt starts her happy trip原创 2016-08-24 01:06:35 · 447 阅读 · 0 评论 -
树形DP______TELE( POJ 1155 )
DescriptionA TV-network plans to broadcast an important football match. Their network of transmitters and users can be represented as a tree. The root of the tree is a transmitter that emits the f原创 2016-08-24 14:29:53 · 536 阅读 · 0 评论 -
树形DP____AllenLSY( POJ 2378 )
DescriptionAfter Farmer John realized that Bessie had installed a "tree-shaped" network among his N (1 Bessie, feeling vindictive, decided to sabotage Farmer John's network by cutting power to原创 2016-08-24 23:31:07 · 584 阅读 · 0 评论 -
树形DP______Tree Cutting( POJ 2378 )
DescriptionAfter Farmer John realized that Bessie had installed a "tree-shaped" network among his N (1 Bessie, feeling vindictive, decided to sabotage Farmer John's network by cutting power to原创 2016-08-25 08:17:56 · 623 阅读 · 0 评论 -
dp+bitset优化______La Vie en rose( hdu 5745 2016多校第二场)
Problem DescriptionProfessor Zhang would like to solve the multiple pattern matching problem, but he only has only one pattern string p=p1p2...pm. So, he wants to generate as many as possible pa原创 2016-08-14 08:36:23 · 1117 阅读 · 0 评论 -
C语言排序(13)___众数问题(Hdu 1029)
Problem Description"OK, you are not too bad, em... But you can never pass the next test." feng5166 says."I will tell you an odd number N, and then N integers. There will be a special integer a原创 2015-03-18 22:04:00 · 2685 阅读 · 0 评论 -
C语言排序(12)___Can you find it?(Hdu 2141)
Problem DescriptionGive you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj原创 2014-12-22 15:37:38 · 1895 阅读 · 0 评论 -
C语言排序(11)___今年暑假不AC
Description“今年暑假不AC?” “是的。” “那你干什么呢?” “看世界杯呀,笨蛋!” “@#$%^&*%...” 确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会抛开电脑,奔向电视了。 作为球迷,一定想看尽量多的完整的比赛,当然,作为新时代的好青年,你一定还会看一些其它的节目,比如新闻联播(永远不要忘记关心国家大事)、非常6+7、超级原创 2014-11-08 12:26:50 · 1789 阅读 · 0 评论 -
C语言排序(10)___ACM成绩统计
DescriptionC++编程考试使用的实时提交系统,具有即时获得成绩排名的特点。它的功能是怎么实现的呢? 我们做好了题目的解答,提交之后,要么“AC”,要么错误,不管怎样错法,总是给你记上一笔,表明你曾经有过一次错误提交,因而当你一旦提交该题“AC”后,就要与你算一算帐了,总共该题错误提交了几回。虽然你在题数上,大步地跃上了一个台阶,但是在耗时上要摊上你共花去的时间。特别是,曾经有原创 2014-11-07 17:47:15 · 2057 阅读 · 0 评论 -
C语言排序(9)___选奶牛
DescriptionFarmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divide原创 2014-11-06 15:46:59 · 1219 阅读 · 0 评论 -
C语言排序(8)___选猴王
DescriptionBackground There are a lot of monkeys in a mountain. Every one wants to be the monkey king. They keep arguing with each other about that for many years. It is your task to help them s原创 2014-11-06 14:16:47 · 1911 阅读 · 0 评论 -
C语言排序(7)___修栅栏
DescriptionAdvanced Cargo Movement, Ltd. is successfully expanding. In order to meet new demands on truck maintenance, the management of the company decided to build a new truck depot. A suitabl原创 2014-11-06 12:23:30 · 1194 阅读 · 0 评论 -
C语言排序(6)___送数字——(二分查找)
DescriptionYou have two friends. You want to present each of them several positive integers. You want to present cnt1 numbers to the first friend and cnt2 numbers to the second friend. Moreover,原创 2014-11-06 11:50:13 · 1060 阅读 · 0 评论 -
C语言排序(1)___水果销售
Description夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了.原创 2014-11-05 09:58:15 · 3305 阅读 · 0 评论 -
C语言排序(4)___ACM contests
DescriptionACM contests, like the one you are participating in, are hosted by the special software. That software, among other functions, preforms a job of accepting and evaluating teams' soluti原创 2014-11-05 13:03:56 · 1285 阅读 · 0 评论 -
C语言排序(3)___考试信息
Description今天的上机考试虽然有实时的Ranklist,但上面的排名只是根据完成的题数排序,没有考虑 每题的分值,所以并不是最后的排名。给定录取分数线,请你写程序找出最后通过分数线的 考生,并将他们的成绩按降序打印。 Input测试输入包含若干场考试的信息。每场考试信息的第1行给出考生人数N ( 0 第M题的正整数分值;以下N行,每行给原创 2014-11-05 10:43:24 · 1450 阅读 · 0 评论 -
C语言排序(5)___青蛙过河——(二分查找)
DescriptionThe annual Games in frogs' kingdom started again. The most famous game is the Ironfrog Triathlon. One test in the Ironfrog Triathlon is jumping. This project requires the frog athletes原创 2014-11-05 18:54:55 · 3824 阅读 · 0 评论 -
C语言排序(2)___'5'变空格
Description输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’组成的,这时这个整数就是0)。 你的任务是:对这些分割得到的整数,依从小到大的顺序排序输出。 Input输入包含多组测试用例,每组输入数据只原创 2014-11-05 10:31:17 · 1550 阅读 · 0 评论 -
最小生成树+树上期望_____Abandoned country(hdu 5723 2016多校第一场)
Problem DescriptionAn abandoned country has n(n≤100000) villages which are numbered from 1 to n. Since abandoned for a long time, the roads need to be re-built. There are m(m≤1000000) roads原创 2016-08-03 19:00:25 · 711 阅读 · 0 评论 -
二分+树dp___zxa and leaf( hdu 5682 BestCoder Round #83 )
问题描述zxa有一棵含有nn个节点的无根树,包含(n-1)(n−1)条无向边,点从11到nn编号,定义每个点的度数为与这个点相连的边的数量,度数为11的节点被称作这棵树的叶子节点。zxa想给每个节点设置它的好看度,好看度必须为正整数。他的无根树有m(1\leq m\leq n)m(1≤m≤n)个叶子节点,其中的k(1\leq k\leq m)k(1≤k≤m)个叶子节点的好看度已经确定,zx原创 2016-06-09 10:43:20 · 767 阅读 · 0 评论