結果

問題 No.129 お年玉(2)
ユーザー recososorecososo
提出日時 2021-05-25 18:30:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,219 ms / 5,000 ms
コード長 1,035 bytes
コンパイル時間 2,426 ms
コンパイル使用メモリ 198,364 KB
実行使用メモリ 395,008 KB
最終ジャッジ日時 2024-04-22 10:02:04
合計ジャッジ時間 30,703 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 328 ms
394,368 KB
testcase_01 AC 307 ms
394,984 KB
testcase_02 AC 307 ms
394,268 KB
testcase_03 AC 306 ms
394,368 KB
testcase_04 AC 308 ms
394,400 KB
testcase_05 AC 401 ms
394,752 KB
testcase_06 AC 831 ms
394,772 KB
testcase_07 AC 773 ms
394,936 KB
testcase_08 AC 382 ms
394,732 KB
testcase_09 AC 917 ms
394,664 KB
testcase_10 AC 704 ms
394,816 KB
testcase_11 AC 627 ms
394,600 KB
testcase_12 AC 444 ms
394,776 KB
testcase_13 AC 403 ms
394,784 KB
testcase_14 AC 881 ms
394,648 KB
testcase_15 AC 738 ms
394,616 KB
testcase_16 AC 773 ms
395,008 KB
testcase_17 AC 919 ms
394,804 KB
testcase_18 AC 672 ms
394,920 KB
testcase_19 AC 460 ms
394,804 KB
testcase_20 AC 1,048 ms
394,932 KB
testcase_21 AC 1,130 ms
394,980 KB
testcase_22 AC 608 ms
394,740 KB
testcase_23 AC 774 ms
394,948 KB
testcase_24 AC 385 ms
394,944 KB
testcase_25 AC 651 ms
394,624 KB
testcase_26 AC 501 ms
394,860 KB
testcase_27 AC 520 ms
394,600 KB
testcase_28 AC 1,219 ms
394,980 KB
testcase_29 AC 310 ms
394,496 KB
testcase_30 AC 313 ms
394,520 KB
testcase_31 AC 311 ms
394,400 KB
testcase_32 AC 310 ms
394,268 KB
testcase_33 AC 309 ms
394,396 KB
testcase_34 AC 311 ms
394,408 KB
testcase_35 AC 316 ms
394,424 KB
testcase_36 AC 312 ms
394,552 KB
testcase_37 AC 312 ms
394,308 KB
testcase_38 AC 362 ms
394,540 KB
testcase_39 AC 390 ms
394,708 KB
testcase_40 AC 687 ms
394,716 KB
testcase_41 AC 457 ms
394,772 KB
testcase_42 AC 357 ms
394,680 KB
testcase_43 AC 342 ms
394,556 KB
testcase_44 AC 527 ms
394,856 KB
testcase_45 AC 334 ms
394,752 KB
testcase_46 AC 360 ms
394,716 KB
testcase_47 AC 690 ms
394,980 KB
testcase_48 AC 411 ms
394,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
const int nmax=10001;
vector<vector<int>> c(nmax,vector<int>(nmax,-1));
int com(int a,int b){
  if(c[a][b]>=0){
    return c[a][b];
  }
  if(a==b||b==0){
    return 1;
  }
  if(a<b||a<0){
    return 0;
  }
  return c[a][b]=(com(a-1,b-1)+com(a-1,b))%mod;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;cin >> n >> m;
    n/=1000;
    ll d=n%m;
    cout << com(m,d) << endl;
}
0