結果

問題 No.1396 Giri
ユーザー rogi52
提出日時 2021-02-15 01:40:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 715 bytes
コンパイル時間 1,723 ms
コンパイル使用メモリ 169,696 KB
実行使用メモリ 7,800 KB
最終ジャッジ日時 2024-07-22 13:29:31
合計ジャッジ時間 3,032 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

vector<int> Eratosthenes(int N){
    vector<int> res, p(N + 1, 1); p[0] = p[1] = 0;
    for(int i = 0; i < N; i++) if(p[i]) {
        for(int j = i + i; j <= N; j += i) p[j] = 0;
    }
    for(int i = 0; i <= N; i++) if(p[i]) res.emplace_back(i);
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    int n; cin >> n;
    ll mod = 998244353;
    auto primes = Eratosthenes(n);
    primes.pop_back();

    ll ans = 1;
    for(auto e : primes){
        ll cur = 1;
        while(cur * e <= n) cur *= e;
        ans *= cur;
        ans %= mod;
    }
    cout << ans << endl;
}
0