結果
問題 | No.1396 Giri |
ユーザー | 夜 |
提出日時 | 2021-02-14 21:35:19 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 58 ms / 2,000 ms |
コード長 | 820 bytes |
コンパイル時間 | 682 ms |
コンパイル使用メモリ | 91,080 KB |
実行使用メモリ | 11,300 KB |
最終ジャッジ日時 | 2023-09-29 14:46:56 |
合計ジャッジ時間 | 2,132 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 57 ms
11,220 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 56 ms
11,116 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | AC | 2 ms
4,376 KB |
testcase_11 | AC | 1 ms
4,380 KB |
testcase_12 | AC | 2 ms
4,376 KB |
testcase_13 | AC | 2 ms
4,376 KB |
testcase_14 | AC | 1 ms
4,376 KB |
testcase_15 | AC | 1 ms
4,380 KB |
testcase_16 | AC | 1 ms
4,376 KB |
testcase_17 | AC | 2 ms
4,380 KB |
testcase_18 | AC | 4 ms
4,376 KB |
testcase_19 | AC | 23 ms
9,488 KB |
testcase_20 | AC | 32 ms
9,548 KB |
testcase_21 | AC | 48 ms
10,400 KB |
testcase_22 | AC | 55 ms
11,020 KB |
testcase_23 | AC | 56 ms
11,292 KB |
testcase_24 | AC | 57 ms
11,300 KB |
testcase_25 | AC | 58 ms
11,148 KB |
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:39:17: 警告: ‘no’ may be used uninitialized [-Wmaybe-uninitialized] 39 | if (i != no) { | ^~ main.cpp:19:22: 備考: ‘no’ はここで定義されています 19 | long long n, no; | ^~
ソースコード
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <iomanip> #include <cmath> #include <stdio.h> #include <queue> #include <deque> #include <cstdio> #include <set> #include <map> #include <bitset> #include <stack> #include <cctype> using namespace std; long long x[1000010]; int main() { long long n, no; long long mod = 998244353; cin >> n; for (int i = 1; i <= n; i++) { x[i] = 1; } for (int i = n; i > 0; i--) { bool bo = true; for (int j = 2; j * j <= n; j++) { if (i % j == 0) { bo = false; } } if (bo) { no = i; break; } } long long ans = 1; for (int i = 2; i <= n; i++) { if (i != no) { long long now = i / x[i]; ans *= now; for (int j = i + i; j <= n; j += i) { x[j] *= now; } ans %= mod; } } cout << ans << endl; }