数学
文章平均质量分 64
shinimashzi
这个作者很懒,什么都没留下…
展开
-
快速幂
思想 快速幂数的快速幂矩阵的快速幂1.数的快速幂上模板LL quickpow(LL a,int b,LL m){ LL ans = 1; if(a == 0) return 0; while(b) { if(b&1)ans = (ans * a)%m; b = (b >> 1); a = (a*a)%m;原创 2017-05-14 17:13:22 · 256 阅读 · 0 评论 -
HDU - 5776 sum/ 蓝桥杯省赛 K倍区间(抽屉原理)
HDU - 5776 http://acm.hdu.edu.cn/showproblem.php?pid=5776Problem Description Given a sequence, you’re asked whether there exists a consecutive subsequence whose sum is divisible by m. output YES, othe原创 2017-06-08 23:06:18 · 320 阅读 · 0 评论 -
HDU - 1556 Color the ball (前缀和)
HDU - 1556思路:这是之前当线段树写的一题,今天看cf419的B题时发现一种很简洁的写法,值得学习,而这题类似,所以拿出来再写了写。更新区间时(l,r)时,d[l]++,d[r+1]--, 然后之后d[i]的答案就是d[1]+d[2] + …+d[i],在纸上推一遍就可以明白。但是自己感觉这种适合查询不多,或者查询和更新是分开的情况。代码真的是简洁 复杂度O(n)#in原创 2017-06-22 23:39:46 · 300 阅读 · 0 评论 -
HDU - 5858 Hard problem (简单几何?)
HDU - 5858 题意:...高中求面积的题?:)虽然题目说是小学可我强行要看成高中的!通过(bd+bc)^2 + ad^2 = ac^2可以算出sin∠acb的值,然后的事情就很简单了。#include #include #include #include #include #include #include using namespace std;con原创 2017-07-17 12:57:33 · 289 阅读 · 0 评论 -
HDU - 5667 Sequence(矩阵快速幂+费马小定理)
写这题的时候压根不知道费马小定理是啥HDU - 5667 Problem Description Holion August will eat every thing he has found. Now there are many foods,but he does not want to eat all of them at once,so原创 2017-07-20 23:42:22 · 375 阅读 · 1 评论