LCM Cardinality UVA - 10892(算术基本定理)
这题就是
LightOJ - 1236
解析去看这个把https://www.cnblogs.com/WTSRUVF/p/9185140.html
贴代码了;
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#define MOD 2018
#define LL long long
#define ULL unsigned long long
#define maxn 10000900
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _ ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;
const int LL_INF = 0x7fffffffffffffff,INF = 0x3f3f3f3f;
LL primes[maxn/];
bool vis[maxn];
LL ans = ;
void init()
{
mem(vis,);
for(int i=; i<maxn; i++)
if(!vis[i])
{
primes[ans++] = i;
for(LL j=(LL)i*i; j<maxn; j+=i)
vis[j] = ;
}
} int main()
{
init();
LL n;
while(cin>> n && n)
{
LL res = , cnt = ;
LL temp = n;
for(LL i=; i<ans && primes[i] * primes[i] <= n; i++)
{
LL cnt2 = ;
while(n % primes[i] == )
{
n /= primes[i];
cnt2++;
}
if(cnt2 > )
{
res *= (*cnt2 + );
}
}
if(n > )
{
res *= ;
}
printf("%lld %lld\n",temp,res/+);
}
return ;
}
LCM Cardinality UVA - 10892(算术基本定理)的更多相关文章
- Pairs Forming LCM LightOJ - 1236 (算术基本定理)
题意: 就是求1-n中有多少对i 和 j 的最小公倍数为n (i <= j) 解析: 而这题,我们假设( a , b ) = n ,那么: n=pk11pk22⋯pkss, a=pd11pd2 ...
- UVA 10892 - LCM Cardinality
Problem F LCM Cardinality Input: Standard Input Output: Standard Output Time Limit: 2 Seconds A pair ...
- UVA 10892 LCM Cardinality 数学
A pair of numbers has a unique LCM but a single number can be the LCM of more than one possiblepairs ...
- UVA 10892 LCM Cardinality(数论 质因数分解)
LCM Cardinality Input: Standard Input Output: Standard Output Time Limit: 2 Seconds A pair of number ...
- Pairs Forming LCM (LightOJ - 1236)【简单数论】【质因数分解】【算术基本定理】(未完成)
Pairs Forming LCM (LightOJ - 1236)[简单数论][质因数分解][算术基本定理](未完成) 标签: 入门讲座题解 数论 题目描述 Find the result of t ...
- hdu4479 (数学题)(算术基本定理)
题目大意 给定一个三元组\((x,y,z)\)的\(gcd\)和\(lcm\),求可能的三元组的数量是多少,其中三元组是的具有顺序的 其中\(gcd\)和\(lcm\)都是32位整数范围之内 由算术基 ...
- LCM Cardinality 暴力
LCM Cardinality Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit St ...
- Aladdin and the Flying Carpet LightOJ - 1341 (素数打表 + 算术基本定理)
题意: 就是求a的因数中大于b的有几对 解析: 先把素数打表 运用算术基本定理 求出a的所有因数的个数 然后减去小于b的因数的个数 代码如下: #include <iostream> #i ...
- LightOJ - 1341 Aladdin and the Flying Carpet (算术基本定理)
题意: 就是....求a的所有大于b的因子有多少对 算术基本定理求 所有因子 阿欧...偷张图. 注意范围 就好 ..... 解析: 在1 -1012的范围内求大于b的所有a的因子的对数(有几对) ...
随机推荐
- 微信小程序开发 [07] 写在后面的话
写在后面的话基本算是吐槽了,在学完小程序的课程之后,我用博客园的api,写了个闪存的小程序,本来兴致勃勃甚至这篇是准备写"我的第一个小程序发布啦",然而并没有. 不是说我偷懒了没写 ...
- 带你看懂大数据采集引擎之Flume&采集目录中的日志
一.Flume的介绍: Flume由Cloudera公司开发,是一种提供高可用.高可靠.分布式海量日志采集.聚合和传输的系统,Flume支持在日志系统中定制各类数据发送方,用于采集数据:同时,flum ...
- SVD(奇异值分解)小结
注:奇异值分解在数据降维中有较多的应用,这里把它的原理简单总结一下,并且举一个图片压缩的例子,最后做一个简单的分析,希望能够给大家带来帮助. 1.特征值分解(EVD) 实对称矩阵 在理角奇异值分解之前 ...
- EEPROM---AT24Cxx应用介绍
结论:1.读写AT24CXX芯片,根据容量有多种方式:一.容量为AT24C01~AT24C16,首先发送设备地址(8位地址),再发送数据地址(8位地址),再发送或者接受数据. 二.AT24C32/AT ...
- java 读写ini配置文件
ini配置文件 ;客户端配置[Client];客户端版本号version=0001;设备号devNum=6405 public final class ConfigurationFile { /** ...
- Kubernetes学习之路(十九)之Kubernetes dashboard认证访问
Dashboard:https://github.com/kubernetes/dashboard 一.Dashboard部署 由于需要用到k8s.gcr.io/kubernetes-dashboar ...
- 设计模式 笔记 适配器模式 Adapter
//---------------------------15/04/13---------------------------- //Adapter 适配器模式 ----类对象结构型模式 /* 1: ...
- stl源码剖析 详细学习笔记 算法(3)
//---------------------------15/03/30---------------------------- //min_element template<class Fo ...
- stl源码剖析 详细学习笔记 RB_tree (1)
// // RB_tree_STL.cpp // 笔记 // // Created by fam on 15/3/21. // // #include "RB_tree_STL.h&q ...
- .Net-C#异步程序知识点梳理
:first-child{margin-top:0!important}.markdown-body>:last-child{margin-bottom:0!important}.markdow ...