Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- using namespace std;
- vector<ll> sieve(ll n){
- vector <bool> isPrime(n + 1, 1);
- isPrime[0] = isPrime[1] = 0;
- for(ll i = 2; i * i <= n; i++){
- if(isPrime[i]){
- for(ll j = i * i; j <= n; j += i)
- isPrime[j] = false;
- }
- }
- vector<ll>v;
- for(ll i = 2; i < n + 1; i++){
- if(isPrime[i]) v.push_back(i*i);
- }
- return v;
- }
- int main() {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- ll n;
- cin >> n;
- map<ll,ll>m;
- ll xx=n;
- for (ll i=2; i*i<=xx; i++) {
- while (n%i==0) {
- m[i]++;
- n/=i;
- }
- if (n==1) break;
- }
- if (n!=1) m[n]++;
- if (m.empty()||m.size()==1 && m.begin()->second==1) {
- cout << 1 << endl << 0;
- return 0;
- }
- ll all=0;
- for (auto x:m) {
- all+=x.second;
- }
- // cout << all << endl;
- if (all==2) cout << 2 << endl;
- else {
- cout << 1 << endl;
- if (m.size()>1) cout << (m.begin()->first) * ((++m.begin())->first);
- else cout << (m.begin()->first) * (m.begin()->first);
- }
- return 0;
- }
- /*
- */
Advertisement
Add Comment
Please, Sign In to add comment