【CF1068B】LCM(数学)

题意:给定b,求lcm(a,b)/a有几种不同的取值

b<=1e10

思路:只有a取b的因子时答案两两不同

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<string>
 4 #include<cmath>
 5 #include<iostream>
 6 #include<algorithm>
 7 #include<map>
 8 #include<set>
 9 #include<queue>
10 #include<vector>
11 using namespace std;
12 typedef long long ll;
13 typedef unsigned int uint;
14 typedef unsigned long long ull;
15 typedef pair<int,int> PII;
16 typedef vector<int> VI;
17 #define fi first
18 #define se second 
19 #define MP make_pair
20 #define N   1100000
21 #define MOD 1000000007
22 #define eps 1e-8 
23 #define pi acos(-1)
24 #define oo 1e18
25 
26 
27 
28 int main()
29 {
30     ll n;
31     scanf("%lld",&n);
32     int ans=0;
33     for(ll i=2;i<=sqrt(n);i++)
34      if(n%i==0)
35      {
36          ans++;
37          if(i*i<n) ans++;
38      }
39     ans+=2;
40     if(n==1) ans=1;
41     printf("%d\n",ans);
42     return 0; 
43 }

 

posted on 2018-10-25 02:56  myx12345  阅读(277)  评论(0编辑  收藏  举报

导航