結果

問題 No.129 お年玉(2)
ユーザー ferin
提出日時 2017-02-13 21:16:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 844 bytes
コンパイル時間 1,691 ms
コンパイル使用メモリ 159,260 KB
実行使用メモリ 569,328 KB
最終ジャッジ日時 2024-12-20 17:46:59
合計ジャッジ時間 11,979 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 MLE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

ll dp[10010][10010];

int main(void)
{
  ll n, m;
  cin >> n >> m;
  ll a = n%(m*1000)/1000;
  if(a == 0) {
    cout << 1 << endl;
    return 0;
  }
  //cout << a << endl;
  //m人にa枚を配る
  REP(i, m+1) {
    REP(j, i+1) {
      if(j == 0 || j == i) dp[i][j] = 1;
      else dp[i][j] = (dp[i-1][j-1] + dp[i-1][j])%INF;
      //cout << dp[i][j] << " ";
    }
    //cout << endl;
  }

  cout << dp[m][a]%INF << endl;
  return 0;
}
0