摘要: 求n的n次方的末尾数字 大概都知道暴力 模拟一下 但是 N 是10^9级别的 会T 所以用 快速幂 要是求n的阶乘就不行了呢 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 10; 阅读全文
posted @ 2017-08-15 21:30 Draymonder 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 每一个 2 与一个 5 相乘,结果就增加一个零。 所以求 n! 后面的连续零的个数,其实就是求其中相乘的数含有因子每对因子 2 与 5 的个数。 又因为从1到某个数,所含 2 的个数比 5 多,所以问题就可以进一步简化到求含有因子5的个数。 然后自己没写出来,没骨气的又看了别人的代码..GG啊 #i 阅读全文
posted @ 2017-08-15 21:21 Draymonder 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 从1到N 里 是2的倍数 有 N/2 个 然后大概看过这类的blog 所以运用容斥原理 直接计算 是 2 3 5 7 的个数都是多少 然后用N 减去 就是 不是2 3 5 7 的个数了 (离散好像也学过 奇加 偶减 #include <bits/stdc++.h> using namespace s 阅读全文
posted @ 2017-08-15 21:04 Draymonder 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 二分+sort 对于一个x 只需查找 数组中是否存在 k-x就可以确定 #include<bits/stdc++.h> using namespace std; int s[50010]; int b_s(int l,int r,int t) { int ans = 0; while (l <= r 阅读全文
posted @ 2017-08-15 16:08 Draymonder 阅读(167) 评论(0) 推荐(0) 编辑
摘要: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1087 暴力大法 #include<bits/stdc++.h> using namespace std; map <int,int>s; void solve() { in 阅读全文
posted @ 2017-08-15 15:19 Draymonder 阅读(183) 评论(0) 推荐(0) 编辑