摘要: http://poj.org/problem?id=3253其实就是求霍夫曼树的值每次取最小和次小的值加起来不断累加直至根节点用priority_queue结果可能很大,要用long long 1 #include 2 #include 3 #include 4 using namespace... 阅读全文
posted @ 2015-05-06 15:05 iswoit 阅读(145) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3069贪心算法每一轮从起点开始,找到中心点,再推算下一轮的起始点一轮结果加1 1 #include 2 #include 3 4 int main() 5 { 6 int r; //半径 7 int n; //节... 阅读全文
posted @ 2015-05-06 14:47 iswoit 阅读(114) 评论(0) 推荐(0) 编辑
摘要: http://hihocoder.com/contest/hiho44/problem/1Nim游戏N堆石子,每堆有任意个数的石子2个玩家轮流取石子,每次从某一堆中取,最少1个,最多取光最后一个取光石子的人获胜Alice先取,问最后谁赢原文中的提示非常详尽。看似复杂,结论却十分简单:P-positi... 阅读全文
posted @ 2015-05-06 14:18 iswoit 阅读(146) 评论(0) 推荐(0) 编辑