QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#642211 | #6566. Power of Divisors | enze114514 | WA | 0ms | 3696kb | C++20 | 1.3kb | 2024-10-15 11:50:04 | 2024-10-15 11:50:05 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb push_back
const ld pi = 3.14159265358979323846;
// const int mod = 998244353;
const ll INF = 1e18;
template<typename T>
T chmax(T a, T b) {
return a > b ? a : b;
}
template<typename T>
T chmin(T a, T b) {
return a > b ? b : a;
}
const int N = (int)2e5 + 1, M = N * 2;
ll qpow(ll a, ll b){
ll res = 1;
while(b > 0){
if(b % 2 == 1){
res = (res * a);
}
a = (a * a);
b /= 2;
}
return res;
}
void solve(){
ll x;
cin >> x;
auto f = [&](ll t) -> ll{
ll qwq = 0;
for(ll i = 1; i * i <= t; i++){
if(t % i == 0){
qwq++;
if(t / i != i){
qwq++;
}
}
}
return qwq;
};
for(int i = 1; f(i) < 32; i++){
if(qpow(i, f(i)) == x){
cout << i << endl;
return;
}
}
cout << -1 << endl;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
// cin >> t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3648kb
input:
15625
output:
25
result:
ok single line: '25'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
64000000
output:
20
result:
ok single line: '20'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
65536
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
10
output:
-1
result:
ok single line: '-1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
100
output:
-1
result:
ok single line: '-1'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
10000
output:
10
result:
ok single line: '10'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
1000000000000000000
output:
100
result:
ok single line: '100'
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3644kb
input:
10372926089038969
output:
-1
result:
wrong answer 1st lines differ - expected: '218089', found: '-1'