結果
| 問題 |
No.1396 Giri
|
| コンテスト | |
| ユーザー |
FF256grhy
|
| 提出日時 | 2021-02-14 22:42:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 460 bytes |
| コンパイル時間 | 1,838 ms |
| コンパイル使用メモリ | 192,764 KB |
| 最終ジャッジ日時 | 2025-01-18 21:04:39 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | int n; scanf("%d", &n);
| ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using LL = long long int;
int f[1'000'000 + 1];
int main() {
int n; scanf("%d", &n);
for(LL i = 2; i * i <= n; i++) {
if(f[i] == 1) { continue; }
for(LL j = i * i; j <= n; j += i) { f[j] = 1; }
}
int c = 0;
LL ans = 1;
for(LL i = n; i >= 2; i--) {
if(f[i] == 1) { continue; }
if(c == 0 && f[i] == 0) { c = 1; continue; }
LL x = i;
while(x * i <= n) { x *= i; }
(ans *= x) %= 998244353;
}
printf("%lld\n", ans);
}
FF256grhy