結果
| 問題 |
No.1396 Giri
|
| コンテスト | |
| ユーザー |
chestnut_68
|
| 提出日時 | 2021-02-14 21:33:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 640 bytes |
| コンパイル時間 | 1,606 ms |
| コンパイル使用メモリ | 174,328 KB |
| 実行使用メモリ | 7,424 KB |
| 最終ジャッジ日時 | 2024-07-22 08:54:31 |
| 合計ジャッジ時間 | 3,100 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 18 WA * 5 |
ソースコード
#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;
}
chestnut_68