• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Oct 11th, 2019 31 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include<bits/stdc++.h>
2. using namespace std;
3. #define int long long
4. #define fastio ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
5. //const long long INF64 = 1'000'000'000'000'000'000ll;
6. #define MOD 1000000007
7. double pow(double a, int n){
8.     double ret =1;
9.     while(n){
10.         if(n%2==1)ret*=a;
11.         a*=a;
12.         n/=2;
13.     }
14.     return ret;
15. }
16. const int MAX_SIZE = 1000009;
17. vector<int >isprime(MAX_SIZE , true);
18. vector<int >prime;
19. vector<int >SPF(MAX_SIZE);
20. void manipulated_seive(int N)
21. {
22.      isprime[0] = isprime[1] = false ;
23.      for (int i=2; i<N ; i++)
24.      {
25.          if (isprime[i])
26.          {
27.              prime.push_back(i);
28.              SPF[i] = i;
29.          }
30.
31.          for (int j=0;j < (int)prime.size() && i*prime[j] < N && prime[j] <= SPF[i];j++)
32.          {
33.              isprime[i*prime[j]]=false;
34.              SPF[i*prime[j]] = prime[j] ;
35.          }
36.      }
37. }
38. int gcd(int a,int b){
39.     if(a==0){
40.         return b;
41.     }
42.     return gcd(b%a,a);
43. }
44. #undef int
45. int main() {
46.     #define int long long
47.     //fastio;
48.     manipulated_seive(1000001);
49.     int n,m;
50.     cin>>n>>m;
51.     //manipulated_seive(1000000);
52.     int count=1;
53.     int a=gcd(n,m);
54.     for(int i=0;i<prime.size();i++){
55.         if(a%prime[i]==(int)0){
56.             count++;
57.             //cout<<prime[i]<<" ";
58.         }
59.     }
60.     {
61.         cout<<count;
62.     }
63.
64.
65.     return 0;
66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?