摘要: 主要还是i^4化成一个(i+1)^4没遇到过,还是很基础的一题矩阵快速幂; #include using namespace std;typedef long long LL;const LL mod=2147493647;const int N=1e5+10;struct asd{ LL... 阅读全文
posted @ 2016-10-31 22:03 see_you_later 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 自己模拟,全靠体会~ #include #include #include #include #include using namespace std;typedef long long LL;const int N=5e4+10;LL a[N];int main(){ int n; ... 阅读全文
posted @ 2016-10-31 21:48 see_you_later 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 思路: 对于这个高度往左能延伸最远x,往右能延伸最远y,(x+1+y)*w; 利用单调栈就行了; #include #include #include #include #include using namespace std;typedef long long LL;const int N... 阅读全文
posted @ 2016-10-31 20:35 see_you_later 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 思路: 预处理一下素数数组,然后暴力计算就好了。 类似处理素数因子; #include #include #include #include using namespace std;typedef long long LL;const long long INF=0x3f3f3f3f;const... 阅读全文
posted @ 2016-10-31 17:49 see_you_later 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 思路: 缩点,计算入度为0点的个数即可; #includeusing namespace std;typedef long long LL;const int N=1e5+10;struct asd{ int to; int next;};asd q[N*4];int head[N... 阅读全文
posted @ 2016-10-31 17:46 see_you_later 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 题意: n个格子,每个格子有一个值。从1开始,每次扔6个面的骰子,扔出几点就往前几步,然后把那个格子的金子拿走; 如果扔出的骰子+所在位置>n,就重新扔,直到在n;问取走这些值的期望值是多少; 思路: 【1】 【2】 【3】【4】 【5】 【6】 【7】 【8】 【9】 //格子和值都是一样,所... 阅读全文
posted @ 2016-10-31 16:34 see_you_later 阅读(564) 评论(0) 推荐(0) 编辑
摘要: 思路: 利用克鲁斯卡尔算法,最小生成树把边从小到大排序,然后Union; 最大生成树就是把边从大到小排序,然后Union; #includeusing namespace std;typedef __int64 LL;const int N=15000;struct asd{ int u,... 阅读全文
posted @ 2016-10-31 16:16 see_you_later 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 题意: 给你一个数,问你有多少种进制对n的表示,存在后导零; 比如30:用3进制表示: 1010 思路: 我们发现,就是一个数的约数就能对n表示最后存在后导零; 计算[2 ,n]之间的n的约数个数。 我们预处理1,大于1说明存在>sqrt(n)的素数,ans*=2,然后乘法原理最后会有一个情... 阅读全文
posted @ 2016-10-31 16:11 see_you_later 阅读(119) 评论(0) 推荐(0) 编辑