Divisors Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9617   Accepted: 2821 Description Your task in this problem is to determine the number of divisors of Cnk. Just for fun -- or do you need any special reason for such a useful compu…
/* uva11610 树状数组+素数打表+离散化 打出的素数范围在2-1000000之间,不超过六位数,然后按照格式翻转成七位数 */ #include<bits/stdc++.h> using namespace std; #define maxn 1000005 #define ll long long int flag[maxn],prime[maxn],cnt; int fac[maxn],a[maxn],tot,p[maxn]; ll bit1[maxn],bit2[maxn];…
题意:给n和k,求组合C(n,k)的因子个数. 这道题,若一开始先预处理出C[i][j]的大小,再按普通方法枚举2~sqrt(C[i][j])来求解对应的因子个数,会TLE.所以得用别的方法. 在说方法前,先说一个n!的性质:n!的素因子分解中的素数p的个数为n/p+n/(p^2)+...+n/(p^k)+... <ACM-ICPC程序设计系列 数论及应用>上的方法,200+ms:首先先求解435以内的素因子.然后预处理出j!中每个素因子的个数,公式如下:num[j][i]=j/prime[i…
每个数都可以分解成素数的乘积: 写成指数形式:n=p1^e1*p2^e2*...*pn^en:(p都是素数) 那么n的因数的数量m=(e1+1)*(e2+1)*...*(en+1): 所以用筛选法筛出1-n的各个素因数的数量: 然后容易得到n!的各个素因数的数量: 因为C(n,k)=n!/k!/(n-k)!: 所以接下来的事就容易办了..... 我的代码: #include<cstdio> using namespace std; ][],sum[][],n,num,kk; ]; long l…
设m=C(n,k)=n!/((n-k)!*k!) 问题:求m的因数的个数 将m分解质因数得到 p1有a1个 p2有a2个 .... 因为每一个质因数能够取0~ai个(所有取0就是1,所有取ai就是m)最后的答案就是(a1+1)*(a2+1)*....* 注意不能直接将m分解,由于太大,所以要先分解n,n-k,k,依据他们再来加减. #include <iostream> #include <cstdio> #include <cmath> #include<cst…
Largest prime factor Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8976    Accepted Submission(s): 3191 Problem Description Everybody knows any number can be combined by the prime number. Now…
ZOJ:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=312 POJ:http://poj.org/problem?id=1595 题目大意: 给你两个数n和c,如果1~n(包括1和n)之间的素数个数为偶数个,则输出中间c*2个素数否则输出中间c*2-1个素数. 思路: 呀呀呀,玩了一天了,A道水题洗洗睡吧. 直接筛选素数打表. 注意c比1~n的个数大的情况要把1~n中所以素数输出. OK,然后这题1也算素数.. #incl…
The Embarrassed Cryptographer Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 11978   Accepted: 3194 Description The young and very promising cryptographer Odd Even has implemented the security module of a large system with thousands of…
解题思路:给定一个数,判定它由几个连续的素数构成,输出这样的种数 用的筛法素数打表 Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20020   Accepted: 10966 Description Some positive integers can be represented by a sum of one or more consecutive…
http://acm.hdu.edu.cn/showproblem.php?pid=5104 找元组数量,满足p1<=p2<=p3且p1+p2+p3=n且都是素数 不用素数打表都能过,数据弱的一比 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <queue> #inclu…