結果

問題 No.1396 Giri
ユーザー 👑 NachiaNachia
提出日時 2021-02-14 21:26:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 1,928 ms
コンパイル使用メモリ 197,540 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-29 14:29:13
合計ジャッジ時間 3,143 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N;
bool sieve[1000001]={};
int p=1;

const ULL M=998244353;

int main(){
  cin>>N;
  sieve[0]=sieve[1]=true;
  for(int i=2; i<=1000000; i++) if(!sieve[i]){
    if(i<=1000) for(int j=i*i; j<=1000000; j+=i) sieve[j]=true;
    if(i<=N) p=i;
  }
  ULL ans=1;
  rep(i,N+1) if(!sieve[i]) if(p!=i) {
    for(ULL j=i; j<=N; j*=i) ans=ans*i%M;
  }
  cout<<ans<<endl;
  return 0;
}
0