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的因子的对数(有几对) ...
随机推荐
- 为什么重写equals还要重写hashcode??
equals和hashcode是object类下一个重要的方法,而object类是所有类的父类,所以所有的类都有这两个方法 equals和hashcode间的关系: 1.如果两个对象相同(即equal ...
- ansible-playbook如何判断并中断执行
- fail: msg="Bailing out. this play requires 'bar'" when: bar is not defined 我的需求是当某 ...
- 在 R 中估计 GARCH 参数存在的问题(续)
目录 在 R 中估计 GARCH 参数存在的问题(续) rugarch 包的使用 简单实验 rugarch 参数估计的行为 极端大样本 结论 在 R 中估计 GARCH 参数存在的问题(续) 本文承接 ...
- Tomcat端口被占用解决方案
Tomcat端口被占用解决方法 1.在dos下,输入 netstat -ano|findstr 8080 //说明:查看占用8080端口的进程,显示占用端口的进程 2.taskkill /pid 19 ...
- 20155217《网络对抗》Exp05 MSF基础应用
20155217<网络对抗>Exp05 MSF基础应用 实践内容 本实践目标是掌握metasploit的基本应用方式,重点常用的三种攻击方式的思路.具体需要完成: 一个主动攻击实践,如ms ...
- 3、class文件加载过程
1.加载2.链接(检验/准备/解析) 1/检验过程:检验class的数据格式.2/准备过程:创建静态域,并将这些域设为默认值.3/解析过程:在一个Java类中会包含对其它.类或接口的形式引用,包括它的 ...
- Hadoop日记Day9---HDFS的java访问接口
一.搭建Hadoop 开发环境 我们在工作中写完的各种代码是在服务器中运行的,HDFS 的操作代码也不例外.在开发阶段,我们使用windows 下的eclipse 作为开发环境,访问运行在虚拟机中的H ...
- 页面弹出全屏浮层或遮罩时,禁止底层body滚动
· 解决方法 针对弹出的浮层的 touchmove事件,添加阻止浏览器默认行为. $('.mask-wrapper').on('touchmove', function (event) { // 监听 ...
- ElasticSearch入门 第四篇:使用C#添加和更新文档
这是ElasticSearch 2.4 版本系列的第四篇: ElasticSearch入门 第一篇:Windows下安装ElasticSearch ElasticSearch入门 第二篇:集群配置 E ...
- 配置LNPM
在 Ubuntu 系统中,可以使用 apt-get 命令来搭建 LNMP环境.这种方式较编译方式安装更加简便,因此选择使用该方式来搭建环境以供学习. 安装Nginx 使用 sudo apt-get i ...