【n!素因子p的幂】swjtuOJ 2090【注:交大的看到这篇文章要学会自己写,不要为了比赛而比赛!~】题目大意数论一道好题:给以两个大整数n,s(n<=10^18,s<=10^12),试找到最大的整数k使得n! % s^k ==0
数论一道不错的题目,很容易想到思路,但是数据会大一点,有可能爆long long ,笔者由于n!素因子p的幂采用累乘法,在10^12左右的一个素数爆掉了,QAQ...
分类:
其他好文 时间:
2015-08-07 11:13:52
阅读次数:
211
题意:将A(n , m)转化成k进制后末尾0的个数。分析:求A(n, m)转化成k进制以后末尾0的个数。对k素因子分解,第i个因子为fac[i],第i个因子的指数为num[i],然后再对n的对A(n, m)进行素因子分解,设count[i]代表fac[i]对应的指数,ans = min{count[...
分类:
其他好文 时间:
2015-08-01 20:25:15
阅读次数:
99
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1189
题目思路:
1/n! = 1/x +1/y==> n! * (x + y) = x * y(右边通分,然后转化)==> n!^2 = (x - n!)*(y - n!)(左右两边加上n方)==> a = b * c ,a = n!^2 ,b...
分类:
其他好文 时间:
2015-08-01 13:03:05
阅读次数:
114
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1299
题目大意:求方程1/x+1/y=1/n的解的个数分析:1/x+1/y = 1/n 设y = n + k;==>1/x + 1/(n+k)=1/n;==>x = n^2/k + n;因为x为整数,k就是n^2的约数。#include
#include
#i...
分类:
其他好文 时间:
2015-08-01 11:35:41
阅读次数:
103
HDU 5317 RGCDQ (素因子分解+预处理)...
分类:
其他好文 时间:
2015-07-28 23:09:21
阅读次数:
156
题目如下:
Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 * p2^k2 *…*pm^km.
Input Specification:
Each input file contai...
分类:
其他好文 时间:
2015-07-26 14:18:45
阅读次数:
124
HDU 3641 Treasure Hunting(阶乘素因子分解+二分)...
分类:
其他好文 时间:
2015-07-06 12:25:10
阅读次数:
108
ACdream 1084 寒假安排(阶乘素因子分解)...
分类:
其他好文 时间:
2015-07-03 12:28:17
阅读次数:
136
题目链接:https://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=1732
hint:素因子分解#include
#include
#include
using namespace std;
typedef long long LL;...
分类:
其他好文 时间:
2015-06-28 12:46:34
阅读次数:
89
51nod 1189 阶乘分数(阶乘素因子分解)...
分类:
其他好文 时间:
2015-06-18 22:16:21
阅读次数:
119