QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#490275 | #6566. Power of Divisors | SmallAoPigBigPiPig# | WA | 0ms | 3840kb | C++14 | 766b | 2024-07-25 13:55:14 | 2024-07-25 13:55:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
long long x;
cin>>x;
long long Anss=-1;
for(int i=100;i>=3;i--){
long long Ans=-1;
for(int j=2;;j++){
int tot=0; long long w=x;
bool flg=true;
for(;w>1;w/=j,++tot)
if(w%j) flg=false;
if(tot<i) break;
if(tot==i&&flg) Ans=j;
}
if(Ans!=-1){
long long w=Ans,v=1;
for(int j=2;j<=w;j++)
if(w%j==0){
long long k=0;
for(;w>1;++k,w/=j)
if(w%j) break;
v=v*(k+1);
if(v>i) break;
}
if(v==i){
Anss=Ans;
break;
}
}
}
if(Anss==-1){
long long Ans=sqrt(x);
bool flg=false;
for(int i=2;1ll*i*i<=Ans;i++)
if(Ans%i==0) flg=true;
if(!flg) Anss=Ans;
}
printf("%lld\n",Anss);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3788kb
input:
15625
output:
25
result:
ok single line: '25'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
64000000
output:
20
result:
ok single line: '20'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
65536
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
1
output:
1
result:
ok single line: '1'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3680kb
input:
10
output:
3
result:
wrong answer 1st lines differ - expected: '-1', found: '3'