結果

問題 No.129 お年玉(2)
コンテスト
ユーザー ninoinui
提出日時 2020-11-23 08:13:01
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 12 ms / 5,000 ms
+ 154µs
コード長 670 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,360 ms
コンパイル使用メモリ 459,296 KB
実行使用メモリ 7,336 KB
最終ジャッジ日時 2026-07-20 13:04:17
合計ジャッジ時間 6,238 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;

using bint = cpp_int;

template <typename T, typename U> bool cmin(T &a, U b) { return a > b && (a = b, true); }
template <typename T, typename U> bool cmax(T &a, U b) { return a < b && (a = b, true); }

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  long N, M;
  cin >> N >> M;

  N %= M * 1000;
  N /= 1000;

  auto com = [&](auto n, auto k) {
    bint ret = 1;
    for (int i = 0; i < k; i++) {
      ret *= n - i;
      ret /= i + 1;
    }
    return ret;
  };
  
  cout << com(M, N) % 1000000000 << "\n";
}
0