結果

問題 No.1396 Giri
ユーザー sapphire__15sapphire__15
提出日時 2021-02-19 03:44:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 2,074 bytes
コンパイル時間 1,200 ms
コンパイル使用メモリ 119,912 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-13 10:55:19
合計ジャッジ時間 2,776 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <functional>
#include <cassert>
#include <stack>
#include <numeric>
#include <iomanip>
#include <limits>

typedef int64_t ll;
typedef std::pair<int, int> Pii;
typedef std::pair<ll, ll> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, _n, _s) for (int i = (_s);i < (int)(_n); i++)
#define all(_l) _l.begin(), _l.end()
#define rall(_l) _l.rbegin(), _l.rend()
#define MM << " " <<

template<typename _T>
using MaxHeap = std::priority_queue<_T>;
template<typename _T>
using MinHeap = std::priority_queue<_T, std::vector<_T>, std::greater<_T>>;

template<typename _T>
inline bool chmax(_T &_l, const _T _b) {
    if (_l < _b) {
        _l = _b;
        return true;
    }
    return false;
}
template<typename _T>
inline bool chmin(_T &_l, const _T _b) {
    if (_l > _b) {
        _l = _b;
        return true;
    }
    return false;
}

# ifdef LOCAL_DEBUG
template<typename _T>
void vdeb(const std::vector<_T> &bb) {
    for (unsigned int i = 0;i < bb.size();i++) {
        if (i == bb.size() - 1) std::cout << bb[i];
        else std::cout << bb[i] << ' ';
    }
    std::cout << '\n';
}
template<typename _T>
void vdeb(const std::vector<std::vector<_T>> &bb) {
    for (unsigned int i = 0;i < bb.size();i++) {
        std::cout << i << ' ';
        vdeb(bb[i]);
    }
    std::cout << '\n';
}
# endif

using namespace std;

const ll MOD = 998244353;

int main() {
    int n; cin >> n;
    vector<bool> da(n+1, true);
    da[0] = false, da[1] = false;
    rip(i,n+1,0) {
        if(da[i]) {
            int now = i*2;
            while(now <= n) {
                da[now] = false;
                now += i;
            }
        }
    }
    ll ans = 1, ma = 0;
    rip(i,n+1,0) {
        if(da[i]) {
            ma = i;
            int now = n/i;
            while(now) {
                ans = (ans%MOD) * i;
                now /= i;
            }
        }
    }
    cout << ans/ma << endl;
}
0