mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 14:36:27 +00:00
parent
dd08012a6c
commit
8392469474
68
LibreOJ/2993/2993.cpp
Normal file
68
LibreOJ/2993/2993.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <cmath>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 1e6 + 5;
|
||||||
|
|
||||||
|
int t, p, primes[N];
|
||||||
|
bool not_prime[N];
|
||||||
|
std::unordered_map<long long, int> map;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
for (int i = 2; i < N; i++) {
|
||||||
|
if (!not_prime[i]) primes[++p] = i;
|
||||||
|
|
||||||
|
for (int j = 1; j <= p && primes[j] * i < N; j++) {
|
||||||
|
not_prime[primes[j] * i] = true;
|
||||||
|
|
||||||
|
if (i % primes[j] == 0) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= p; i++) {
|
||||||
|
long long x = primes[i];
|
||||||
|
map[x * x * x] = primes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
cin >> t;
|
||||||
|
|
||||||
|
while (t--) {
|
||||||
|
long long n, ans = 1;
|
||||||
|
|
||||||
|
cin >> n;
|
||||||
|
|
||||||
|
int m = std::sqrt(std::sqrt(n));
|
||||||
|
|
||||||
|
if (map.count(n)) {
|
||||||
|
cout << map[n] << endl;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1, x = primes[i]; i <= p && x <= m && static_cast<long long>(x) * x * x <= n; x = primes[++i]) {
|
||||||
|
long long y = static_cast<long long>(x) * x * x;
|
||||||
|
|
||||||
|
while (n % y == 0) {
|
||||||
|
ans *= x;
|
||||||
|
n /= y;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (n % x == 0) {
|
||||||
|
n /= x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (map.count(n)) ans *= map[n];
|
||||||
|
|
||||||
|
cout << ans << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
LibreOJ/2993/data/cube1.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube1.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube10.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube10.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube2.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube2.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube3.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube3.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube4.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube4.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube5.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube5.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube6.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube6.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube7.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube7.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube8.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube8.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube9.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2993/data/cube9.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2993/data/cube9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user