QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#792209 | #6566. Power of Divisors | lukamosiashvili# | WA | 0ms | 3764kb | C++17 | 1.4kb | 2024-11-29 06:31:12 | 2024-11-29 06:31:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
long long ans = -1, n;
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin >> n;
if(n == 1){
cout << 1;
return 0;
}
long long sq = sqrt(n);
if(sq * sq == n){
bool flag = 0;
for(long long i = 2; i <= sqrt(sq); i++){
if(sq % i == 0){
flag = 1;
break;
}
}
if(!flag) ans = sq;
}
long long cb = cbrt(n);
long long sq_cb = sqrt(cb);
if(cb * cb * cb == n && sq_cb * sq_cb == cb){
bool flag = 0;
for(long long i = 2; i < sq_cb; i++){
if(cb % i == 0){
flag = 1;
break;
}
}
if(!flag) ans = cb;
}
for(long long i = 1; i <= 50000; i++) {
long long gamy = 0;
long long sq = sqrt(i);
for(long long j = 1; j <= sq; j++){
if(i % j == 0) gamy += 2;
}
if(sq * sq == i) gamy--;
long long nam = 1;
for(int ii = 1; ii <= gamy; ii++){
if(n / i + 2 <= nam){
nam = n + 1;
break;
}
nam *= i;
}
if(nam == n){
if(ans > i) ans = i;
break;
}
}
cout << ans;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3760kb
input:
15625
output:
25
result:
ok single line: '25'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3764kb
input:
64000000
output:
-1
result:
wrong answer 1st lines differ - expected: '20', found: '-1'