結果

問題 No.129 お年玉(2)
ユーザー MisterMister
提出日時 2020-04-22 10:40:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3,204 ms / 5,000 ms
コード長 756 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 76,516 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 09:46:12
合計ジャッジ時間 32,831 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
5,248 KB
testcase_01 AC 3,204 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 966 ms
5,376 KB
testcase_06 AC 468 ms
5,376 KB
testcase_07 AC 1,183 ms
5,376 KB
testcase_08 AC 1,463 ms
5,376 KB
testcase_09 AC 332 ms
5,376 KB
testcase_10 AC 1,454 ms
5,376 KB
testcase_11 AC 615 ms
5,376 KB
testcase_12 AC 10 ms
5,376 KB
testcase_13 AC 5 ms
5,376 KB
testcase_14 AC 452 ms
5,376 KB
testcase_15 AC 391 ms
5,376 KB
testcase_16 AC 666 ms
5,376 KB
testcase_17 AC 235 ms
5,376 KB
testcase_18 AC 1,258 ms
5,376 KB
testcase_19 AC 2,019 ms
5,376 KB
testcase_20 AC 855 ms
5,376 KB
testcase_21 AC 286 ms
5,376 KB
testcase_22 AC 777 ms
5,376 KB
testcase_23 AC 1,379 ms
5,376 KB
testcase_24 AC 2,405 ms
5,376 KB
testcase_25 AC 545 ms
5,376 KB
testcase_26 AC 1,063 ms
5,376 KB
testcase_27 AC 952 ms
5,376 KB
testcase_28 AC 739 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 3 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 4 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 75 ms
5,376 KB
testcase_39 AC 58 ms
5,376 KB
testcase_40 AC 156 ms
5,376 KB
testcase_41 AC 386 ms
5,376 KB
testcase_42 AC 177 ms
5,376 KB
testcase_43 AC 10 ms
5,376 KB
testcase_44 AC 2,504 ms
5,376 KB
testcase_45 AC 97 ms
5,376 KB
testcase_46 AC 11 ms
5,376 KB
testcase_47 AC 1,930 ms
5,376 KB
testcase_48 AC 1,499 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <numeric>
#include <vector>

using lint = long long;
constexpr lint MOD = 1000000000;

template <class T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }

void solve() {
    lint n, m;
    std::cin >> n >> m;

    n /= 1000;
    n %= m;

    std::vector<lint> ps(n);
    std::iota(ps.begin(), ps.end(), m - n + 1);

    for (lint x = 1; x <= n; ++x) {
        lint y = x;
        for (auto& p : ps) {
            auto g = std::gcd(y, p);
            p /= g;
            y /= g;
        }
    }

    lint ans = 1;
    for (auto p : ps) (ans *= p) %= MOD;
    std::cout << ans << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0