UOJ#548.数学
1 #include<iostream> 2 #include<algorithm> 3 #include<cmath> 4 #include<cstdio> 5 #include<cstring> 6 #define ll long long 7 using namespace std; 8 const int oo=0x3f3f3f3f; 9 10 ll n,nn,ans1=1,ans2,sum; 11 bool ok,ook; 12 13 ll get(){ 14 char zy=getchar(); 15 ll z=1,y=0; 16 while(zy>'9'||zy<'0'){ 17 if(zy=='-') z=-1; 18 zy=getchar(); 19 } 20 while(zy>='0'&&zy<='9'){ 21 y=(y<<1)+(y<<3)+zy-'0'; 22 zy=getchar(); 23 } 24 return z*y; 25 } 26 27 ll Max(ll a,ll b){return a>b?a:b;} 28 29 void find(){ 30 for(ll i=2;i*i<=nn;){ 31 if(n%i==0){ 32 if(!ok){ 33 ok=1; 34 ans1*=i; 35 } 36 sum++; 37 n/=i; 38 continue; 39 } 40 ok=0;i++; 41 ans2=Max(ans2,sum); 42 if(sum&&sum<ans2) ook=1; 43 sum=0; 44 } 45 if(n!=1){ 46 if(ans2>1) ook=1; 47 } 48 ans1*=n; 49 } 50 51 bool sexy(){ 52 for(ll i=2;i*i<=n;i++){ 53 if(n%i==0) return false; 54 } 55 printf("%lld 0\n",n); 56 } 57 58 int main(){ 59 n=nn=get(); 60 if(sexy()) return 0; 61 find(); 62 sum=1; 63 printf("%lld ",ans1); 64 for(ll i=1;1;i++){ 65 sum*=2; 66 if(sum>ans2){ 67 printf("%d\n",i+1); 68 break; 69 } 70 else if(sum==ans2){ 71 printf("%d\n",i+ook); 72 break; 73 } 74 } 75 return 0; 76 }