結果

問題 No.129 お年玉(2)
ユーザー ninoinuininoinui
提出日時 2020-11-23 08:13:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 670 bytes
コンパイル時間 7,960 ms
コンパイル使用メモリ 393,616 KB
最終ジャッジ日時 2025-01-16 04:52:13
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#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