随笔分类 - 03.贪心
摘要:一道贪心的水题,读完题目,直接把样例的三个数试一试,就知道怎么一种组合方式会产生最小的结果。 (让我想起了哈弗曼编码,用了优先队列) 需要注意的是,POJ上那个double类型的printf,需要用%f而不是%lf,要不然就WA。 具体为什么是这样,那道题的discuss里有。
阅读全文
摘要:据网上传闻,用高斯消元解?(我就是在学高斯消元的时候看到有拿这个题当练手题的) 但是,看到discuss上有人说根本不用什么高斯消元和搜索,我一想也是……这题显然用贪心啊…… 首先前提:翻转问题,1、每个碗只有主动翻转一次和不主动翻转两种情况;2、主动翻转碗的顺序对结果没有影响。 于是我们的思路是,
阅读全文
摘要:一定要纪念一下第一道在比赛中自己做出来的贪心。 题目链接:http://acm.ecnu.edu.cn/problem/3263/ Time limit per test: 1.0 seconds Time limit all tests: 1.0 seconds Memory limit: 256
阅读全文
摘要:因为在允许的情况下,必然是左右手交替进行,这样不会增加多余的无谓的能量。 然后根据不同的分界点,肯定会产生左手或右手重复使用的情况,这是就要加上Qr/Ql * 次数。 一开始的想法,很直接,枚举每个分界点,计算出总共要用的能量,取最小的那个即是答案: 但是在数据来那个很大的情况下会超时。 所以考虑到
阅读全文
摘要:time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output time limit per test 2 seconds time limit
阅读全文
摘要:和HDU 1789 - Doing Homework again一个套路
阅读全文
摘要:zscoder loves simple strings! A string t is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple w
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1789 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Descripti
阅读全文
摘要:Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating
阅读全文
摘要:Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13982 Accepted: 5349 Description A group of N people wishes to go across a river with only
阅读全文
摘要:Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15
阅读全文
摘要:题目链接:http://jnuacm.club:8080/oj/problem_show.php?pid=1032 小明喜欢把土豆块放在食物处理器中处理。长度不超过H的土豆块放入处理器中,处理器每秒处理长度为k(即土豆块长度减少k)。如果土豆块长度小于k,土豆块会被完全处理掉。 小明有n块土豆,第i
阅读全文

浙公网安备 33010602011771号