计算一个给定区间中因数最多的数。
分析:数论、组合数学。题目的数据的比较大,如果暴力一定会超时,那么就考虑利用其他方法求解。
我们将给定数字因式分解,那么因数的个数就是π(各质因子数+1)。(每个质因子取0~上限个)
因为数据时在10^9之内,所以质因数只能是33333以内的素数,利用筛法将素数打表计算即可。
#include...
分类:
其他好文 时间:
2015-06-16 23:03:55
阅读次数:
153
poj 1845 Sumdiv
题意:
给出两个数a,b,求a^b的约数的和,结果模9901。
限制:
0
思路:
约数和公式:
对于已经分解的整数a=(p1^k1)*(p2^k2)*(p3^k3)*....*(pn^kn)
则,a的所有约数之和为
S=(1+p1+p1^2+p1^3+...p1^k1) * (1+p2+p2^2+p2^3+….p2^k2) * (1+p...
分类:
其他好文 时间:
2015-06-16 09:29:49
阅读次数:
120
题目:给你一个多项式(x1+x2+..+xk)^ n,求x1^k1*x2^k2*..*xn^kn的系数。
分析:组合数学,多项式系数。
系数为:C(n,k1)* C(n-k1,k2)* .. *C(n-k1-..-kn-1,kn)= n! /(k1!k2!..kn!)。
说明:好久没怎么刷题了╮(╯▽╰)╭。
#include
using namespace ...
分类:
其他好文 时间:
2015-06-13 14:17:42
阅读次数:
119
DescriptionAssuming a finite – radius “ball” which is on an N dimension is cut with a “knife” of N-1 dimension. How many pieces will the “ball” be cut...
分类:
其他好文 时间:
2015-06-12 13:07:58
阅读次数:
128
[BZOJ 3997] [TJOI 2015] 组合数学
分类:
其他好文 时间:
2015-06-12 11:40:09
阅读次数:
113
1.定义卡特兰数又称卡塔兰数,英文名Catalan number,是组合数学中一个常出现在各种计数问题中出现的数列。由以比利时的数学家欧仁·查理·卡塔兰 (1814–1894)命名,其前几项为 :1, 2, 5, 14, 42, 132...递推式:令h(0)=1,h(1)=1,(1) Catala...
分类:
其他好文 时间:
2015-06-11 14:18:23
阅读次数:
112
2014ACM/ICPC亚洲区西安站 F题 color (组合数学,容斥原理)...
分类:
其他好文 时间:
2015-06-11 11:08:00
阅读次数:
143
卡塔兰数,是组合数学中一个常出现在各种计数问题中出现的数列。输入一个整数n,计算h(n)。h(n)= h(0)*h(n-1)+h(1)*h(n-2) + ... + h(n-1)h(0) (其中n>=2,h(0) = h(1) = 1)该递推关系的解为:h(n)=C(2n,n)/(n+1) (n=1...
分类:
其他好文 时间:
2015-06-09 15:39:04
阅读次数:
138
你的组合数学学得如何?
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB
Total submit users: 151, Accepted users: 119
Problem 11547 : No special judgement
Problem descripti...
分类:
其他好文 时间:
2015-06-08 23:26:46
阅读次数:
156
代码:
#include
#include
#define N 1000
#define mod 1000000007
using namespace std;
long long dp[N+5];
int main()
{
dp[1]=2;
dp[2]=3;
for(int i=3;i<=N;i++)
{
dp[i]=(dp[i-1]%mod...
分类:
其他好文 时间:
2015-06-07 23:40:54
阅读次数:
311