結果

問題 No.129 お年玉(2)
ユーザー nenuonnenuon
提出日時 2017-06-22 15:01:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 489 ms / 5,000 ms
コード長 806 bytes
コンパイル時間 806 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 425,424 KB
最終ジャッジ日時 2023-08-18 18:00:00
合計ジャッジ時間 26,544 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 482 ms
424,884 KB
testcase_01 AC 483 ms
424,944 KB
testcase_02 AC 481 ms
425,248 KB
testcase_03 AC 483 ms
424,928 KB
testcase_04 AC 481 ms
424,844 KB
testcase_05 AC 483 ms
425,252 KB
testcase_06 AC 485 ms
424,896 KB
testcase_07 AC 487 ms
425,244 KB
testcase_08 AC 480 ms
424,860 KB
testcase_09 AC 485 ms
425,320 KB
testcase_10 AC 482 ms
424,904 KB
testcase_11 AC 482 ms
424,900 KB
testcase_12 AC 481 ms
424,932 KB
testcase_13 AC 481 ms
424,932 KB
testcase_14 AC 481 ms
425,272 KB
testcase_15 AC 483 ms
424,856 KB
testcase_16 AC 483 ms
424,932 KB
testcase_17 AC 482 ms
424,880 KB
testcase_18 AC 481 ms
425,424 KB
testcase_19 AC 483 ms
424,992 KB
testcase_20 AC 488 ms
424,904 KB
testcase_21 AC 485 ms
424,904 KB
testcase_22 AC 486 ms
425,328 KB
testcase_23 AC 487 ms
425,224 KB
testcase_24 AC 487 ms
425,244 KB
testcase_25 AC 484 ms
424,904 KB
testcase_26 AC 483 ms
424,948 KB
testcase_27 AC 483 ms
424,848 KB
testcase_28 AC 486 ms
424,856 KB
testcase_29 AC 485 ms
425,244 KB
testcase_30 AC 483 ms
424,992 KB
testcase_31 AC 486 ms
424,852 KB
testcase_32 AC 487 ms
424,932 KB
testcase_33 AC 486 ms
424,932 KB
testcase_34 AC 489 ms
425,248 KB
testcase_35 AC 482 ms
425,248 KB
testcase_36 AC 483 ms
424,896 KB
testcase_37 AC 488 ms
424,856 KB
testcase_38 AC 484 ms
424,848 KB
testcase_39 AC 485 ms
425,400 KB
testcase_40 AC 485 ms
425,248 KB
testcase_41 AC 481 ms
425,400 KB
testcase_42 AC 482 ms
425,216 KB
testcase_43 AC 482 ms
424,928 KB
testcase_44 AC 481 ms
424,900 KB
testcase_45 AC 483 ms
425,244 KB
testcase_46 AC 482 ms
424,844 KB
testcase_47 AC 481 ms
425,220 KB
testcase_48 AC 483 ms
425,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
vector<vector<long long> > dp(10001);
int main(){
  long long n, m;
  cin >> n >> m;
  n %= m * 1000;
  n /= 1000;
  dp[1].push_back(1);
  dp[1].push_back(1);
  FOR(i,1,10000){
    FOR(j,0,i+2){
      if(j == 0) dp[i+1].push_back(dp[i][j]);
      else if(j == i+1) dp[i+1].push_back(dp[i][i]);
      else dp[i+1].push_back(dp[i][j-1] + dp[i][j]);
      dp[i+1][j] %= 1000000000;
    }
  }
  if(n==0){
    cout << 1 << endl;
  } else {
    cout << dp[m][n] << endl;
  }
  return 0;
}
0