上一页 1 ··· 5 6 7 8 9 10 11 12 下一页
摘要: 1 a,m和不一定互素的时候,欧拉定理的应用 a^phi(m)%m=a^(k*phi(m) ) %m (证明用到中国剩余定理)2 发现A 满足的同余式以后 ,由于phi(m) #include #include using namespace std; struct robber { int money; int id; double inf; }; int cmp(robber x,robber y) { if(x.inf>size; for(int l=0;l>n>>m>>y; int *p=new int [n]; for(int i=0;i>. 阅读全文
posted @ 2013-07-22 03:08 814jingqi 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 1 a,m和不一定互素的时候,欧拉定理的应用 a^phi(m)%m=a^(k*phi(m) ) %m (证明用到中国剩余定理)2 发现A 满足的同余式以后 ,由于phi(m) #include #include using namespace std; struct robber { int money; int id; double inf; }; int cmp(robber x,robber y) { if(x.inf>size; for(int l=0;l>n>>m>>y; int *p=new int [n]; for(int i=0;i>. 阅读全文
posted @ 2013-07-22 03:08 814jingqi 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 题目地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2343题目分析:1题目大意就是按照预先定好的标准分钱,一个很大的提示就是 y不整除m ,自然想到先用代余除法,把能按照这个方式分的钱分完再说,但是余下的钱仍然可能过比n大不好分应该是先每个人得到 [ x[i]*k/m ] 这么多钱 ,由高斯函数的性质知余下的钱不会多于n, 最后挑出对整体的 "方案不均匀系数"(即最后要求最小的那个数)影响最小的left个人(还剩left 块钱)2 注意要点 将每个人放在struct 中,包含id 信息,这样在 阅读全文
posted @ 2013-07-22 03:00 814jingqi 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 题目地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2343题目分析:1题目大意就是按照预先定好的标准分钱,一个很大的提示就是 y不整除m ,自然想到先用代余除法,把能按照这个方式分的钱分完再说,但是余下的钱仍然可能过比n大不好分应该是先每个人得到 [ x[i]*k/m ] 这么多钱 ,由高斯函数的性质知余下的钱不会多于n, 最后挑出对整体的 "方案不均匀系数"(即最后要求最小的那个数)影响最小的left个人(还剩left 块钱)2 注意要点 将每个人放在struct 中,包含id 信息,这样在 阅读全文
posted @ 2013-07-22 03:00 814jingqi 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 题目地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1394注意要点:1根本不需要真正构建出树的结构 否则反而超内存由于最后的结果等于 w【i】*l【i】求和 换成加法 w【i】应该加层数那么多次,而这样的构建方式使根结点的权值恰好等于所有叶子节点权值之和(包括中间状态)所以在每次创建新结点时,把新结点的权值加到最后的结果中去,那么每个权值被加的次数等于它出于多少颗树中,恰好等于它的高度2即使是weight 也应该用long long保存 因为p【i】已经可达10^9 #include #include using n 阅读全文
posted @ 2013-07-22 02:46 814jingqi 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1394注意要点:1根本不需要真正构建出树的结构 否则反而超内存由于最后的结果等于 w【i】*l【i】求和 换成加法 w【i】应该加层数那么多次,而这样的构建方式使根结点的权值恰好等于所有叶子节点权值之和(包括中间状态)所以在每次创建新结点时,把新结点的权值加到最后的结果中去,那么每个权值被加的次数等于它出于多少颗树中,恰好等于它的高度2即使是weight 也应该用long long保存 因为p【i】已经可达10^9 #include #include using n 阅读全文
posted @ 2013-07-22 02:46 814jingqi 阅读(350) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; int quick_mod(int a,int b,int m) { a=a%m; int ans=1; while(b) { if(b&1) { ans=(ans*a)%m; } b>>=1; a=(a*a)%m; } return ans; } int main() { int size; cin>>size; int m; int h; int a,b; while(cin>>m) ... 阅读全文
posted @ 2013-07-21 19:40 814jingqi 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 比赛地址:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26269#overview题解报告:http://blog.watashi.ws/816/andrew-stankevich-2-solution/ 阅读全文
posted @ 2013-07-20 19:50 814jingqi 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 比赛地址:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26268解题报告:http://bbs.whu.edu.cn/wForum/disparticle.php?boardName=ACM_ICPC&ID=1105535381 阅读全文
posted @ 2013-07-19 22:22 814jingqi 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 比赛地址:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=25749解题报告: http://blog.watashi.ws/640/andrew-stankevich-8-solution/ 阅读全文
posted @ 2013-07-19 22:14 814jingqi 阅读(72) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 下一页