QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#114072 | #6566. Power of Divisors | UFRJ# | WA | 1ms | 3824kb | C++20 | 891b | 2023-06-20 21:06:04 | 2023-06-20 21:06:06 |
Judging History
answer
#include "bits/stdc++.h"
using lint = int64_t;
using namespace std;
map<lint,lint> memo;
int countDiv(lint x) {
set<lint> st;
for(lint i = 1; i <= sqrt(x) + 1; i++) {
if(x % i == 0) {
st.insert(i);
st.insert(x/i);
}
}
return st.size();
}
lint f(lint x) {
return pow(x, countDiv(x));
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
lint n;
cin >> n;
for(int i = 2; i <= 70; i++) {
lint raiz1 = pow(n, 1.0/i) - 1;
lint raiz2 = pow(n, 1.0/i);
lint raiz3 = pow(n, 1.0/i) + 1;
if(f(raiz1) == n) {
cout << raiz1 << endl;
return 0;
}
if(f(raiz2) == n) {
cout << raiz2 << endl;
return 0;
}
if(f(raiz3) == n) {
cout << raiz3 << endl;
return 0;
}
}
cout << -1 << endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3824kb
input:
15625
output:
25
result:
ok single line: '25'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
64000000
output:
20
result:
ok single line: '20'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3740kb
input:
65536
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
10
output:
-1
result:
ok single line: '-1'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
100
output:
-1
result:
ok single line: '-1'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3736kb
input:
10000
output:
10
result:
ok single line: '10'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
1000000000000000000
output:
100
result:
ok single line: '100'
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3784kb
input:
10372926089038969
output:
-1
result:
wrong answer 1st lines differ - expected: '218089', found: '-1'