摘要: 思路: = =杨辉三角的应用,组合数的应用; C(N+M,N); 逆元一发,费马小定理,OK。#include #include #include using namespace std;typedef long long LL;const LL mod=1e9+7;LL cal(... 阅读全文
posted @ 2016-08-31 23:51 see_you_later 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 思路: 很水的dp吧。。。问的都是能否组成。。 哦对,这里sum最大才2e7,不会是2e9所以放心dp#include#include #include#include#includeusing namespace std;typedef __int64 LL;const int ... 阅读全文
posted @ 2016-08-31 23:46 see_you_later 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 思路: 掐住最后一位,快速幂一发就好了#include#include #include#include#includeusing namespace std;typedef __int64 LL;int cal(int g,int x){ int ans=1; whi... 阅读全文
posted @ 2016-08-31 23:44 see_you_later 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 思路1.: 离线处理; 具体就是把岛屿离线然后按照高度排序,把query按照从高到低排序,然后每次query只要从最高的岛屿开始找起,判断条件:如果他旁边都是没有被找过的(也就是默认是海),那么数量+1,如果两边都是岛屿,那么数量-1,我们不需要判断一边是岛屿,一边是海没意义 思路... 阅读全文
posted @ 2016-08-31 23:42 see_you_later 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 思路: 就是先正常的dp一下求一个最大连续子串,然后特殊情况就是sum-最小连续子串。。 比一比谁大谁小就好了#include #include #include using namespace std;typedef long long LL;const int N=5e4+10... 阅读全文
posted @ 2016-08-31 23:40 see_you_later 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 思路: 不晓得阿,n%9==0即n数值各个位加起来要%9==0; 如果知道这个,那么%90==0就是末尾多个0就好了,那么后面就是随便搞吧;#include #include #include using namespace std;typedef long long LL;con... 阅读全文
posted @ 2016-08-31 23:35 see_you_later 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 思路: 2和5能构成0,然后就是看2和5因子组成个数,然而我们知道,1-n中2的因子数肯定>5的,所以我们只要求一下1-n中5的因子个数就好了。。。#include #include #include using namespace std;typedef long long LL... 阅读全文
posted @ 2016-08-31 23:33 see_you_later 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 直接打表构造啊#include #include #include using namespace std;typedef long long LL;const int N=1e5+10;int a[N];int d[N];void init(){ d[0]=a[0]=0; ... 阅读全文
posted @ 2016-08-31 23:30 see_you_later 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 思路: 简单的区间dp,从小区间到大区间,随便写。 还有一种是那啥,n-LCS。。。具体不说了,赶时间)))= =、#include #include #include using namespace std;typedef long long LL;const int N=1e3... 阅读全文
posted @ 2016-08-31 23:29 see_you_later 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 暴力即可!!!#include #include #include using namespace std;typedef long long LL;const int N=1e4+10;LL a[N];int n;int main(){ int s,t; LL sum... 阅读全文
posted @ 2016-08-31 23:27 see_you_later 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 思路: 这道题嘛有些弯还是要转的,比如你说让你搞n的倍数,你别老老实实照她的意思去啊,倍数可以除法,取膜 。 因为n个数我们可以求前缀和然后取膜,对n取膜的话有0-n-1种情况,所以方案一定是有的,说的好听一点就是因为鸽巢原理,如果取膜=0那直接输出,如果有两种相等的,减一下输出就... 阅读全文
posted @ 2016-08-31 23:24 see_you_later 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 思路: 这题不能说是长见识,倒是第一次写这么富有套路的题,倒着来,二分区间嘛,这个很简单啊,二分的条件查询一个当前区间的最小值是不是比那个特定的值小,一步步缩小,这就是二分嘛,然后查询用线段树的RMQ写法搞,logn。 二分的模型是0000000111111111这个,窝还是照着自... 阅读全文
posted @ 2016-08-31 23:08 see_you_later 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2016-08-31 11:03 see_you_later 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2016-08-31 10:35 see_you_later 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2016-08-31 10:34 see_you_later 阅读(1709) 评论(0) 推荐(0) 编辑