提出 #3839614
ソースコード 拡げる
#include <cstdio>
long long qpow(long long a, long long n) {
long long res = 1;
for (; n; n >>= 1, a *= a) if (n & 1) res *= a;
return res;
}
int main() {
long long n, p;
scanf("%lld %lld", &n, &p);
long long ans = 1;
for (int i = 2; 1ll * i * i <= p; i++) if (p % i == 0) {
int cnt = 0;
while (p % i == 0) {
++cnt;
p /= i;
}
ans *= qpow(i, cnt / n);
}
if (p > 1 && n == 1) ans *= p;
printf("%lld\n", ans);
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Product and GCD |
| ユーザ | Pepcy_Ch |
| 言語 | C++14 (GCC 5.4.1) |
| 得点 | 300 |
| コード長 | 553 Byte |
| 結果 | AC |
| 実行時間 | 5 ms |
| メモリ | 128 KiB |
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:11:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld %lld", &n, &p);
^
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample1.txt, sample2.txt, sample3.txt, sample4.txt |
| All | sample1.txt, sample2.txt, sample3.txt, sample4.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 1.txt | AC | 1 ms | 128 KiB |
| 10.txt | AC | 1 ms | 128 KiB |
| 11.txt | AC | 1 ms | 128 KiB |
| 12.txt | AC | 0 ms | 128 KiB |
| 13.txt | AC | 0 ms | 128 KiB |
| 14.txt | AC | 0 ms | 128 KiB |
| 15.txt | AC | 3 ms | 128 KiB |
| 16.txt | AC | 1 ms | 128 KiB |
| 17.txt | AC | 2 ms | 128 KiB |
| 18.txt | AC | 1 ms | 128 KiB |
| 19.txt | AC | 0 ms | 128 KiB |
| 2.txt | AC | 2 ms | 128 KiB |
| 20.txt | AC | 1 ms | 128 KiB |
| 21.txt | AC | 1 ms | 128 KiB |
| 22.txt | AC | 1 ms | 128 KiB |
| 23.txt | AC | 5 ms | 128 KiB |
| 24.txt | AC | 1 ms | 128 KiB |
| 25.txt | AC | 1 ms | 128 KiB |
| 26.txt | AC | 1 ms | 128 KiB |
| 3.txt | AC | 1 ms | 128 KiB |
| 4.txt | AC | 0 ms | 128 KiB |
| 5.txt | AC | 1 ms | 128 KiB |
| 6.txt | AC | 1 ms | 128 KiB |
| 7.txt | AC | 1 ms | 128 KiB |
| 8.txt | AC | 2 ms | 128 KiB |
| 9.txt | AC | 1 ms | 128 KiB |
| sample1.txt | AC | 1 ms | 128 KiB |
| sample2.txt | AC | 1 ms | 128 KiB |
| sample3.txt | AC | 1 ms | 128 KiB |
| sample4.txt | AC | 1 ms | 128 KiB |