Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- // #include <iostream>
- // #include <cstdio>
- // #include <cstdlib>
- // #include <algorithm>
- // #include <cmath>
- // #include <vector>
- // #include <set>
- // #include <map>
- // #include <queue>
- // #include <ctime>
- // #include <cassert>
- // #include <complex>
- // #include <string>
- // #include <cstring>
- // #include <queue>
- // #include <bitset>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- #define ff first
- #define ss second
- #define pb push_back
- #define mp make_pair
- #define in insert
- #define vi vector< int >
- #define vll vector< ll >
- #define f0(b) for(int i=0;i<(b);i++)
- #define f00(b) for(int j=0;j<(b);j++)
- #define f1(b) for(int i=1;i<=(b);i++)
- #define f11(b) for(int j=1;j<=(b);j++)
- #define f2(a,b) for(int i=(a);i<=(b);i++)
- #define f22(a,b) for(int j=(a);j<=(b);j++)
- #define RFOR(i,x,y) for(int i=x;i>=y;i--)
- #define unq(v) sort(all(v)),(v).resize(unique(all(v))-v.begin())
- #define all(v) v.begin(),v.end()
- #define rall(v) v.rbegin(),v.rend()
- #define reversed(s) reverse(s.begin(), s.end())
- #define testcase ll t; cin>>t; while (t--)
- #define vout(v) for(int ind=0;ind<v.size();ind++){ cout<<v[ind]; if(ind<v.size()-1) cout<<' '; else cout<<endl;}
- #define arrout(arr,i,x,y) for(int i=x;i<=y;i++){ cout<<arr[i]; if(i<y) cout<<' '; else cout<<endl;}
- #define READ() freopen("input.txt", "r", stdin)
- #define WRITE() freopen("output.txt", "w", stdout)
- #define sci(n) scanf("%d",&n)
- #define scii(x,y) scanf("%d %d",&x,&y)
- #define scl(n) scanf("%lld",&n)
- #define scll(x,y) scanf("%lld %lld",&x,&y)
- #define gtl(x) getline(cin, (x))
- #define PI acos(-1)
- #define CLR(x, y) memset(x, y, sizeof(x))
- #define Precision(a) cout << fixed << setprecision(a)
- #define Flame() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
- #define MAXP 1000006
- #define MOD 1e9+7//10000007
- #define EPS 1e-7
- template <typename T> T Sqr(T x) { T n = x * x ; return n ;}
- template <typename T> T Pow(T B,T P){ if(P==0) return 1; if(P&1) return B*Pow(B,P-1); else return Sqr(Pow(B,P/2));}
- template <typename T> T Abs(T a) {if(a<0)return -a;else return a;}
- template <typename T> T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
- template <typename T> T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
- template <typename T> T BigMod (T b,T p,T m){if (p == 0) return 1;if (p%2 == 0){T s = BigMod(b,p/2,m);return ((s%m)*(s%m))%m;}return ((b%m)*(BigMod(b,p-1,m)%m))%m;}
- template <typename T> inline string ToBinary(T n) {string r ;while(n != 0) {r = ( n % 2 == 0 ? "0" : "1" ) + r ; n >>= 1;} return r ;}
- long long BinaryToDecimal(string s) {int len = s.size();long long n = 0, p = 1;for (int i = len - 1; i >= 0; i-- , p *= 2) n += p * (s[i] - '0');return n;}
- int Strtoint(string str){stringstream ss(str);int x = 0;ss >> x ;return x ;}
- string Intostr(int x){stringstream ss; ss << x; string str = ss.str(); return str;}
- #define bug printf("**!\n")
- #define DB(x) cout << #x << " = " << x << endl
- #define DDB(x, y) cout << #x << " = " << x << " " << #y << " = " << y << endl
- #define DDDB(x, y, z) cout << #x << " = " << x << " " << #y << " = " << y << " " << #z << " = " << z << endl
- int main()
- {
- // Flame();
- ll n;
- while(cin >> n && n)
- {
- vector<ll> v;
- if(n<0)
- {
- n=n*(-1);
- }
- ll x=n;
- for(ll i=2; i*i<=n; i++)
- {
- if(x%i==0)
- {
- while(x%i==0)
- {
- x/=i;
- }
- v.pb(i);
- }
- }
- if(x>1) v.pb(x);
- ll sz=v.size();
- if(sz<=1) cout << -1 << endl;
- else cout << v[sz-1] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement