結果

問題 No.1396 Giri
ユーザー chestnut_68chestnut_68
提出日時 2021-02-14 21:33:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 640 bytes
コンパイル時間 1,507 ms
コンパイル使用メモリ 171,288 KB
実行使用メモリ 7,368 KB
最終ジャッジ日時 2023-09-29 14:43:35
合計ジャッジ時間 2,774 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 23 ms
7,220 KB
testcase_02 AC 22 ms
7,124 KB
testcase_03 WA -
testcase_04 AC 22 ms
7,124 KB
testcase_05 AC 23 ms
7,112 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 22 ms
7,176 KB
testcase_09 WA -
testcase_10 AC 24 ms
7,120 KB
testcase_11 AC 24 ms
7,148 KB
testcase_12 AC 24 ms
7,136 KB
testcase_13 AC 23 ms
7,136 KB
testcase_14 AC 23 ms
7,120 KB
testcase_15 AC 23 ms
7,196 KB
testcase_16 AC 22 ms
7,112 KB
testcase_17 AC 22 ms
7,136 KB
testcase_18 WA -
testcase_19 AC 22 ms
7,164 KB
testcase_20 AC 25 ms
7,340 KB
testcase_21 AC 25 ms
7,140 KB
testcase_22 AC 23 ms
7,128 KB
testcase_23 AC 24 ms
7,204 KB
testcase_24 AC 24 ms
7,120 KB
testcase_25 AC 23 ms
7,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int64_t MOD=998244353LL;
const int64_t MAX=1e6+1;
set<int64_t> P;
void Prime(){
  vector<bool> B(MAX,true);
  B[0]=false;
  B[1]=false;
  for(int64_t i=2;i<MAX;i++){
    if(B[i]){
      P.insert(i);
      int64_t a=i;
      while(i*a<MAX){
        B[i*a]=false;
        a++;
      }
    }
  }
}
int main(){
  Prime();
  int64_t N,c=0,ans=1;cin>>N;
  auto itr=P.lower_bound(N);
  itr--;
  int64_t K=*itr;
  for(auto i:P){
    if(i==K)break;
    int64_t a=i,S=N;
    while(a<=N){
      ans*=i;
      ans%=MOD;
      a*=i;
    }
  }
  cout<<ans<<endl;
}
0