摘要: 模板题,注意输出 #include <stdio.h> #include <string.h> #include <algorithm> #include <math.h> #include <vector> #include <stack> using namespace std; typedef 阅读全文
posted @ 2016-05-12 23:43 shuguangzw 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 参考这篇博客: http://blog.csdn.net/ascii991/article/details/7466278 #include <stdio.h> #include <string.h> #include <algorithm> #include <math.h> #include < 阅读全文
posted @ 2016-05-12 22:59 shuguangzw 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 题解上说的很清楚了,我照着写的,表示膜拜题解 然后时间复杂度我觉得应该是O(nlogn),虽然常数略大,预处理和倒着扫,都是O(nlogn) #include <stdio.h> #include <string.h> #include <algorithm> #include <math.h> # 阅读全文
posted @ 2016-05-12 18:34 shuguangzw 阅读(472) 评论(0) 推荐(0) 编辑
摘要: 感觉很简单,就是讨论一下 #include <stdio.h> #include <string.h> #include <algorithm> #include <math.h> using namespace std; typedef pair<double,int>pii; const int 阅读全文
posted @ 2016-05-12 14:09 shuguangzw 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 题意:有n个人,每个人a[i]个物品,进行k次操作,每次都从最富有的人手里拿走一个物品给最穷的人 问k次操作以后,物品最多的人和物品最少的人相差几个物品 分析:如果次数足够多的话,最后的肯定在平均值上下,小的最多被补到sum/n,大最多减少到sum/n,或者sum/n+1 然后就二分最小值,看所有小 阅读全文
posted @ 2016-05-12 14:08 shuguangzw 阅读(289) 评论(0) 推荐(0) 编辑