結果

問題 No.1396 Giri
ユーザー ShibuyapShibuyap
提出日時 2021-02-19 17:21:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 1,203 bytes
コンパイル時間 2,459 ms
コンパイル使用メモリ 201,364 KB
実行使用メモリ 7,992 KB
最終ジャッジ日時 2023-10-14 11:35:11
合計ジャッジ時間 4,148 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,732 KB
testcase_01 AC 13 ms
7,808 KB
testcase_02 AC 15 ms
7,988 KB
testcase_03 AC 14 ms
7,776 KB
testcase_04 AC 14 ms
7,812 KB
testcase_05 AC 17 ms
7,836 KB
testcase_06 AC 13 ms
7,740 KB
testcase_07 AC 14 ms
7,836 KB
testcase_08 AC 13 ms
7,992 KB
testcase_09 AC 13 ms
7,784 KB
testcase_10 AC 13 ms
7,988 KB
testcase_11 AC 13 ms
7,976 KB
testcase_12 AC 13 ms
7,852 KB
testcase_13 AC 13 ms
7,780 KB
testcase_14 AC 13 ms
7,976 KB
testcase_15 AC 13 ms
7,836 KB
testcase_16 AC 13 ms
7,772 KB
testcase_17 AC 14 ms
7,928 KB
testcase_18 AC 14 ms
7,740 KB
testcase_19 AC 15 ms
7,932 KB
testcase_20 AC 16 ms
7,780 KB
testcase_21 AC 16 ms
7,964 KB
testcase_22 AC 17 ms
7,956 KB
testcase_23 AC 17 ms
7,852 KB
testcase_24 AC 17 ms
7,736 KB
testcase_25 AC 17 ms
7,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("YES");}else{puts("NO");}
#define MAX_N 200005

/*
    Max_Prime以下の素数をprimes[]に格納
*/

const int Max_Prime = 1100000;
int tmp_primes[Max_Prime];
vector<int> primes;

void PrimeInit() {
    rep(i,Max_Prime)tmp_primes[i] = 1;
    tmp_primes[0] = 0;
    tmp_primes[1] = 0;

    rep(i,Max_Prime){
        if(tmp_primes[i] == 0)continue;
        int j = 2;
        while(i * j < Max_Prime){
            tmp_primes[i*j] = 0;
            j++;
        }
    }
    
    rep(i,Max_Prime){
        if(tmp_primes[i])primes.push_back(i);
    }
}



int main() {
    PrimeInit();
    ll n; cin >> n;
    int ma = 0;
    srep(i,1,n+1) if(tmp_primes[i]) ma = i;
    ll ans = 1;
    const ll MOD = 998244353;
    
    srep(i,1,n+1){
        if(i == ma) continue;
        if(tmp_primes[i] == 0) continue;
        ll num = i;
        while(num * i <= n) num *= i;
        ans = ans * num % MOD;
    }

    cout << ans << endl;
    return 0;
}
 
 
0