摘要: 题目:POJ-1936-All in All水题。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 char s[100010],t[100010];1... 阅读全文
posted @ 2015-02-09 09:42 alohagin 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 题目:UVA-10970-Big Chocolate水题。思路:先n-1刀切成m*1的条再切。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 int ... 阅读全文
posted @ 2015-02-09 09:10 alohagin 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目:ZOJ-3132-DNA Consensus String 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 char str[55][1010];... 阅读全文
posted @ 2015-02-07 17:44 alohagin 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 题目:POJ-2159-Ancient Cipher哈希,映射可以是随机的!!! 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 char sa[110... 阅读全文
posted @ 2015-01-26 20:58 alohagin 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题目:UVA-11039-Building designing根据绝对值排序。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 int a[500010... 阅读全文
posted @ 2015-01-26 20:17 alohagin 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 题目:UVA-11636-Hello World!贪心。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 int main()11 {12 in... 阅读全文
posted @ 2015-01-26 15:34 alohagin 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 题目:UVA-10881-Piotr's Ants思路:模拟,看成对穿而过求终状态,然而相对顺序不变,排序即可。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; ... 阅读全文
posted @ 2015-01-26 10:57 alohagin 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 题目:POJ-3154-Graveyard一个周长为10000的圆圈,一开始等距的安放着N个雕塑,现在想增加M个雕塑,使得雕塑之间还是等距,问坟墓最少移动的距离。思路:只有n个时设周长为1,则坐标为i/n,加m后周长扩至n+m{好处是新坐标为整数,0~n+m-1},新坐标为i/n*(m+n)的四舍五... 阅读全文
posted @ 2015-01-23 12:08 alohagin 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 题目:UVA-11300-Spreading the Wealth思路:对于人i有 现有Ai-出xi+入xi+1=平均M,Ci=Σ1~i(Ai-M),得C中有x0使得0,C1~Cn-1与其差的和最小,即为answer,x0为C中位数。wa#include #include#include#inclu... 阅读全文
posted @ 2015-01-22 18:08 alohagin 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 题目:UVA-11729-Commando War贪心,按执行时间从大到小排序。 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 struct job{10 int b,j;... 阅读全文
posted @ 2015-01-22 15:41 alohagin 阅读(127) 评论(0) 推荐(0) 编辑