数学 CF1068B LCM
CF1068B LCM
给定一个正整数\(b (1\leq b \leq 10^{10})\)。 把一个正整数a从1枚举到\(10^{18}\),求有多少种不同的\(\large \frac{[a,b]}{a}\)。
分析:
\]
b是不变的,那么答案就是\(\frac{b}{(a,b)}\)的个数,又又因为b不变,答案就是\((a,b)\)的个数,又又又因为b不变,答案就是b的因子的个数。
有趣
code:
#include <iostream>
#include <cstdio>
#define int long long
using namespace std;
inline int read(){
int sum=0,f=1; char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
while(ch>='0'&&ch<='9'){sum=(sum<<1)+(sum<<3)+ch-'0'; ch=getchar();}
return sum*f;
}
int ans,b;
signed main(){
b=read();
for(int i=1;i*i<=b;i++)
if(b%i==0)
if(i*i!=b)ans+=2;
else ans++;
printf("%lld\n",ans);
return 0;
}
数学 CF1068B LCM的更多相关文章
- 一筐鸡蛋的lcm
问题 一筐鸡蛋,一个一个取正好取完,两个两个取剩下一个,三个三个取正好取完,四个四个取剩下一个,五个五个取少一个,六个六个取剩下三个,七个七个取正好取完,八个八个取剩下一个,九个九个取正好取完,共多少 ...
- 【CF1068B】LCM(数学)
题意:给定b,求lcm(a,b)/a有几种不同的取值 b<=1e10 思路:只有a取b的因子时答案两两不同 #include<cstdio> #include<cstring& ...
- acdream.LCM Challenge(数学推导)
LCM Challenge Time Limit:1000MS Memory Limit:64000KB 64bit IO Format:%lld & %llu Submit ...
- 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 ...
- HDU 5584 LCM Walk 数学
LCM Walk Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5584 ...
- hdu 4497 GCD and LCM 数学
GCD and LCM Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4 ...
- Codeforces Round #328 (Div. 2) C. The Big Race 数学.lcm
C. The Big Race Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/592/probl ...
- hdu 5584 LCM Walk(数学推导公式,规律)
Problem Description A frog has just learned some number theory, and can't wait to show his ability t ...
- CC Subarray LCM (数学)
题目连接:http://www.codechef.com/problems/SUBLCM 题意:给定一个序列,求最长连续子序列满足 LCM(Ai,Ai+1...Aj) =Ai*Ai+1*...*Aj. ...
随机推荐
- Cannot subclass final class class com.sun.proxy.$Proxy16
Cannot subclass final class class com.sun.proxy.$Proxy16 2016年05月04日 19:10:58 阅读数:15028 背景 这个错误是我在使用 ...
- js中直接对字符串转义-用于solr ulr 关键词转义
js代码 /* * 获取UTC格式的字符串,参数必须是 */var solrDateFormat = function (o){ var date; if(typeof o == 'str ...
- Python手机开发调用DLL实现部分ADB功能-乾颐堂
近期学了一点Python,然后正好有一个手机同步工具方面的预研工作要完成. 要实现PC与手机的通信,首先要找到他们的通信协议,还好的是Android有完善的协议:ADB ADB的代码是开源的,而且支持 ...
- Spring Boot☞ 使用freemarker模板引擎渲染web视图
效果图 代码 package com.wls.integrateplugs.hello.controller; /** * Created by wls on 2017/8/24. */ import ...
- hdu 4946 Area of Mushroom (凸包,去重点,水平排序,留共线点)
题意: 在二维平面上,给定n个人 每个人的坐标和移动速度v 若对于某个点,只有 x 能最先到达(即没有人能比x先到这个点或者同时到这个点) 则这个点称作被x占有,若有人能占有无穷大的面积 则输出1 , ...
- osgQt支持触摸屏
1. osgQt的构造函数添加:setAttribute(Qt::WA_AcceptTouchEvents);//wyh 2. event()修改,支持触摸时间 bool GLWidget::even ...
- eclipse Subversion Native Library Not Available
参考:http://blog.csdn.net/zp357252539/article/details/44880319 Subversion Native Library Not Available ...
- Exception (2) Java Exception Handling
The Java programming language uses exceptions to handle errors and other exceptional events.An excep ...
- Android 控件在布局中按比例放置[转]
转自:http://netsky1990.blog.51cto.com/2220666/997452 在Android开发中常用到线性布局LinearLayout对界面进行具体的创建,其中 ...
- web项目不能链接数据库
mysql的root没有权限 例如,你想root使用123456从任何主机连接到mysql服务器. 1 mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@' ...