Peng Lv

毋意,毋必,毋固,毋我。 言必行,行必果。

导航

2012年5月20日 #

{HDU}{4221}{Greedy}{Greedy}

摘要: 贪心处理,关键是寻找题意中隐含的条件,并且证明贪心算法的正确性。输出一定用"%I64d"而不是"%lld"!#include <iostream>#include <string>#include <cstring>#include <cstdio>#include <algorithm>#include <memory>#include <cmath>#include <bitset>#include <queue>#include <ve 阅读全文

posted @ 2012-05-20 01:13 Lvpengms 阅读(304) 评论(0) 推荐(0) 编辑

{HDU}{4217}{Data Structure}{树状数组or线段树}

摘要: 思路:在给定的序列中一次那周第Ki小的数,求和。这题用线段树很容易就AC我用的是树状数组,中间涉及到一个二分查找的过程,出了太多错误了,这个题WA成狗了。。。(1)二分中求最左的数(2)树状数组的初始化本题很特殊。。。#include <iostream>#include <string>#include <cstring>#include <cstdio>#include <algorithm>#include <memory>#include <cmath>#include <bitset>#i 阅读全文

posted @ 2012-05-20 00:04 Lvpengms 阅读(301) 评论(0) 推荐(0) 编辑