QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#348919 | #6566. Power of Divisors | janY# | WA | 8ms | 3700kb | C++17 | 1008b | 2024-03-09 22:18:39 | 2024-03-09 22:18:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void solve(){
long long d, n;
cin >> n;
if (n == 1){
cout << 1 << "\n";
return;
}
long long xtra = n;
for (int i = 2; i < 2000000; i++){
if (n%i == 0){
while (xtra%i == 0) xtra /= i;
int cnt = 0;
long long ni = n;
while (ni%i == 0) {
ni /= i;
cnt++;
}
if (ni != 1) continue;
int dcnt = 0;
for (int j = 1; j <= i; j++){
if (i%j == 0) dcnt++;
}
if (cnt == dcnt){
cout << i << "\n";
return;
}
}
}
if (xtra < 1e9){
if (xtra*xtra == n) {
cout << xtra << "\n";
return;
}
}
cout << "-1\n";
}
int main(){
int t = 1;
//cin >> t;
for (int i = 0; i < t; i++) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3552kb
input:
15625
output:
25
result:
ok single line: '25'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
64000000
output:
20
result:
ok single line: '20'
Test #3:
score: 0
Accepted
time: 3ms
memory: 3492kb
input:
65536
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 6ms
memory: 3596kb
input:
10
output:
-1
result:
ok single line: '-1'
Test #6:
score: 0
Accepted
time: 6ms
memory: 3640kb
input:
100
output:
-1
result:
ok single line: '-1'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
10000
output:
10
result:
ok single line: '10'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
1000000000000000000
output:
100
result:
ok single line: '100'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3596kb
input:
10372926089038969
output:
218089
result:
ok single line: '218089'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
10642944803293201
output:
10157
result:
ok single line: '10157'
Test #11:
score: -100
Wrong Answer
time: 8ms
memory: 3488kb
input:
10646534823110209
output:
-1
result:
wrong answer 1st lines differ - expected: '103182047', found: '-1'