Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //In the Name of Allah Most Gracious, Most Merciful//
- /*If you want something you've never had, you have to do something you never did.*/
- #include<bits/stdc++.h>
- using namespace std;
- #define pb push_back
- #define ll long long
- #define pii pair<ll,ll>
- #define pll pair<ll,ll>
- #define M 10000007
- #define INF 1e9
- #define INFL 1e18
- #define PI acos(-1)
- #define mp make_pair
- #define fast_in_out ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- //const ll fx[]= {+1,-1,+0,+0};
- //const ll fy[]= {+0,+0,+1,-1};
- //const ll fx[]={+0,+0,+1,-1,-1,+1,-1,+1}; // Kings Move
- //const ll fy[]={-1,+1,+0,+0,+1,+1,-1,-1}; // Kings Move
- //const ll fx[]={-2, -2, -1, -1, 1, 1, 2, 2}; // Knights Move
- //const ll fy[]={-1, 1, -2, 2, -2, 2, -1, 1}; // Knights Move
- #define SIZE 100100
- vector<ll>prime;
- bool mark[M+10];
- vector<ll>v;
- ll arr[SIZE];
- void sieve()
- {
- ll i,j;
- prime.push_back(2);
- for(i=3;i*i<=M;i+=2)
- {
- if(mark[i]==false)
- {
- for(j=i*i;j<=M;j+=2*i)
- mark[j]=true;
- }
- }
- for(i=3;i<=M;i+=2)
- {
- if(mark[i]==false)
- prime.push_back(i);
- }
- }
- int NOD(int n)
- {
- int ans=1;
- int sqrtN=sqrt(n);
- for(int i=0;i<prime.size() && prime[i]<=sqrtN;i++)
- {
- int x=0;
- while(n%prime[i]==0)
- {
- n=n/prime[i];
- x++;
- }
- sqrtN=sqrt(n);
- x++;
- ans=ans*x;
- }
- if(n!=1)
- ans=ans*2;
- return ans;
- }
- int main()
- {
- fast_in_out;
- //freopen("input.txt","r",stdin);
- //freopen("output.txt","w",stdout);
- sieve();
- int n;
- cin>>n;
- int ans=NOD(n);
- cout<<ans<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement