CodeForcesGym 100753F Divisions
Divisions
This problem will be judged on CodeForcesGym. Original ID: 100753F
64-bit integer IO format: %I64d Java class name: (Any)

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = ;
LL mul(LL a,LL b,LL mod) {
if(!a) return ;
return ((a&)*b%mod + (mul(a>>,b,mod)<<)%mod)%mod;
}
LL quickPow(LL a,LL d,LL n) {
LL ret = ;
while(d) {
if(d&) ret = mul(ret,a,n);
d >>= ;
a = mul(a,a,n);
}
return ret;
}
bool check(LL a,LL d,LL n) {
if(n == a) return true;
while(~d&) d >>= ;
LL t = quickPow(a,d,n);
while(d < n- && t != && t != n-) {
t = mul(t,t,n);
d <<= ;
}
return (d&) || t == n-;
}
bool isP(LL n) {
if(n == ) return true;
if(n < || == (n&)) return false;
static int p[] = {,,,,};
for(int i = ; i < ; ++i)
if(!check(p[i],n-,n)) return false;
return true;
}
LL gcd(LL a,LL b) {
if(a < ) return gcd(-a,b);//特别注意,没这个TLE
return b?gcd(b,a%b):a;
}
LL Pollard_rho(LL n,LL c) {
LL i = ,k = ,x = rand()%n,y = x;
while(true) {
x = (mul(x,x,n) + c)%n;
LL d = gcd(y - x,n);
if(d != && d != n) return d;
if(y == x) return n;
if(++i == k) {
y = x;
k <<= ;
}
}
}
LL Fac[maxn],tot;
void factorization(LL n) {
if(isP(n)) {
Fac[tot++] = n;
return;
}
LL p = n;
while(p >= n) p = Pollard_rho(p,rand()%(n-)+);
factorization(p);
factorization(n/p);
}
unordered_map<LL,LL>ump;
int main() {
LL x;
srand(time());
while(~scanf("%I64d",&x)){
tot = ;
if(x == ) {
puts("");
continue;
}
if(isP(x)){
puts("");
continue;
}
factorization(x);
ump.clear();
for(int i = ; i < tot; ++i)
ump[Fac[i]]++;
unsigned long long ret = ;
for(auto &it:ump) ret *= (it.second + );
printf("%I64u\n",ret);
}
return ;
}
/*
999999999999999989
100000007700000049
*/
CodeForcesGym 100753F Divisions的更多相关文章
- CodeForcesGym 100512D Dynamic LCA
Dynamic LCA Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. ...
- CodeForcesGym 100517I IQ Test
IQ Test Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. Orig ...
- CodeForcesGym 100517B Bubble Sort
Bubble Sort Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. ...
- CodeForcesGym 100517H Hentium Scheduling
Hentium Scheduling Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForc ...
- CodeForcesGym 100524J Jingles of a String
Jingles of a String Time Limit: 2000ms Memory Limit: 524288KB This problem will be judged on CodeFor ...
- CodeForcesGym 100524A Astronomy Problem
Astronomy Problem Time Limit: 8000ms Memory Limit: 524288KB This problem will be judged on CodeForce ...
- CodeForcesGym 100212E Long Dominoes
Long Dominoes Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged on CodeForcesGym. ...
- CodeForcesGym 100753K Upside down primes
Upside down primes Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForc ...
- CodeForcesGym 100753B Bounty Hunter II
Bounty Hunter II Time Limit: 5000ms Memory Limit: 262144KB This problem will be judged on CodeForces ...
随机推荐
- js 获取图片宽高 和 图片大小
获取要查看大小的img var img_url = 'http://img5.imgtn.bdimg.com/it/u=4267222417,1017407570&fm=200&gp= ...
- 【Tair】淘宝分布式NOSQL框架:Tair
Tair是淘宝的一个开源项目,它是一个分布式的key/value结构数据的解决方案. 一.基本组成 作为一个分布式系统,Tair由一个中心控制节点(config server)和一系列的服务节点(da ...
- loadrunner乱码解决
对于Virtual User Generator,本机编码方式为GB2312,GBK,GB18030,因此要修改为utf-8 1.录制过程产生的乱码解决方法: 在tool→recording opti ...
- 关于java的print()
print方法是类PrintStream的方法成员,而System类有一个static的PrintStream类型的属性成员,名叫out,我们平时写的System.out.print("he ...
- Listview多种布局的使用
ListView中有两个可以用来让ListView可以在视图中显示多种布局的方法,分别是getItemType和getViewTypeCount 其中 getItemViewType返回的是有参数po ...
- Java易忘知识点统计
缺少 内容 替代措施 幂运算 借助Math类的pow方法 注意 内容 备注 const Java保留关键字,未使用 其他 强制类型转换时,若要舍入得到最接近的整数,可以使用Math.round方法 J ...
- vue路由传参(学习心得)
如果组件通过query来传递num参数为1,相当与在 url 地址后面拼接参数 <template> <div> <h3>首页</h3> <rou ...
- 使用openssl搭建CA并颁发服务器证书
本来整理了一份执行脚本,但是没有找到附件功能.只好直接贴当时自己看过的链接了. 文章标题:Openssl Certificate Authority 转载链接:https://jamielinux.c ...
- 最优化方法系列:SGD、Adam
整理一下资源,不过最好还是根据书上的理论好好推导一下..... 文章链接:Deep Learning 最优化方法之SGD 72615436 本文是Deep Learning 之 最优化方法系列文章 整 ...
- 【alert(1) to win】不完全攻略
alert(1) to win 一个练习XSS的平台,地址:https://alf.nu/alert1 Warmup 给出了一段JavaScript代码 function escape(s) { re ...