1620:质因数分解
程序员文章站
2022-07-14 09:46:12
...
#pragma GCC optimize(2)
#include <bits/stdc++.h>
//#include <iostream>
//#include <algorithm>
//#include <cstdio>
//#include <cstring>
#define rush() int T;cin>>T;while(T--)
#define go(a) while(cin>>a)
#define ms(a,b) memset(a,b,sizeof a)
#define E 1e-8
#define debug(a) cout<<"*"<<a<<"*"<<endl
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PAUSE system("pause")
using namespace std;
typedef long long ll;
typedef unsigned ui;
typedef unsigned long long ull;
typedef pair<int,int> Pair;
const int inf=0x7f7f7f7f;
const int mod=100003;
const int N=1e6+5;
int n,m,t;
ll i,j,k;
bool vis[N];
ll prime[N],num;
void init(){
for(ll i=2;i<50000;i++)
if(!vis[i]){
prime[++num]=i;
for(ll j=i*2;j<50000;j+=i)
vis[j]=1;
}
}
int main()
{
IOS;
cin>>n; init();
for(i=1;i<=num;i++){
if(n%prime[i]==0){
cout<<n/prime[i]<<endl;
break;
}
}
//PAUSE;
return 0;
}