結果
| 問題 |
No.1396 Giri
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-02-14 21:26:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 515 bytes |
| コンパイル時間 | 1,813 ms |
| コンパイル使用メモリ | 192,312 KB |
| 最終ジャッジ日時 | 2025-01-18 20:36:29 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#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;
}
Nachia