結果

問題 No.1396 Giri
ユーザー SSRSSSRS
提出日時 2021-02-14 21:26:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 587 bytes
コンパイル時間 1,485 ms
コンパイル使用メモリ 166,884 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-29 14:29:02
合計ジャッジ時間 2,591 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 9 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 10 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 10 ms
4,376 KB
testcase_23 AC 10 ms
4,376 KB
testcase_24 AC 10 ms
4,380 KB
testcase_25 AC 10 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int main(){
  int N;;
  cin >> N;
  vector<bool> prime(N + 1, true);
  for (int i = 2; i <= N; i++){
    if (prime[i]){
      for (int j = i * 2; j <= N; j += i){
        prime[j] = false;
      }
    }
  }
  int f = N;
  while (!prime[f]){
    f--;
  }
  long long ans = 1;
  for (int i = 2; i <= N; i++){
    if (prime[i] && i != f){
      int N2 = N;
      int mul = 1;
      while (N2 > i){
        N2 /= i;
        mul *= i;
      }
      ans *= mul;
      ans %= MOD;
    }
  }
  cout << ans << endl;
}
0