結果

問題 No.1396 Giri
ユーザー だれだれ
提出日時 2021-02-14 21:55:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,424 bytes
コンパイル時間 4,190 ms
コンパイル使用メモリ 259,528 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-29 15:17:48
合計ジャッジ時間 5,348 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 11 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 11 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 11 ms
4,376 KB
testcase_23 AC 11 ms
4,380 KB
testcase_24 AC 11 ms
4,376 KB
testcase_25 AC 11 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define i64 long long
template<class T>
bool chmin(T& a, const T& b) { return (b < a) ? (a = b, true) : false; }
template<class T>
bool chmax(T& a, const T& b) { return (b > a) ? (a = b, true) : false; }

using mint = modint998244353;

vector<bool> erat(long long n)
{
    vector<bool> res(n + 1, true);
    res[0] = false;
    res[1] = false;
    for(long long i = 2; i <= n; i++)
    {
        if(res[i])
        {
            if(i * i <= n)
            {
                for(long long j = i * i; j <= n; j += i)
                {
                    res[j] = false;
                }
            }
        }
    }
    return res;
}

int main()
{
    int n;
    cin >> n;
    auto f = erat(n);
    mint ans = 1;
    int k = 1;
    for (int i = 1; i <= n; i++)
    {
        if(f[i])
        {
            auto u = n;
            auto x = n / i;
            if(x == 1) k = i;
            while(u > i)
            {
                ans *= i;
                u /= i;
            }
        }
    }
    ans /= k;
    cout << ans.val() << endl;
}
0