結果

問題 No.129 お年玉(2)
ユーザー recososorecososo
提出日時 2021-05-25 18:30:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 960 ms / 5,000 ms
コード長 1,035 bytes
コンパイル時間 2,146 ms
コンパイル使用メモリ 203,388 KB
実行使用メモリ 394,944 KB
最終ジャッジ日時 2023-08-04 12:26:29
合計ジャッジ時間 28,835 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 314 ms
394,580 KB
testcase_01 AC 279 ms
394,944 KB
testcase_02 AC 279 ms
394,484 KB
testcase_03 AC 278 ms
394,336 KB
testcase_04 AC 278 ms
394,272 KB
testcase_05 AC 390 ms
394,552 KB
testcase_06 AC 688 ms
394,712 KB
testcase_07 AC 705 ms
394,896 KB
testcase_08 AC 373 ms
394,540 KB
testcase_09 AC 741 ms
394,808 KB
testcase_10 AC 675 ms
394,760 KB
testcase_11 AC 574 ms
394,540 KB
testcase_12 AC 378 ms
394,580 KB
testcase_13 AC 348 ms
394,588 KB
testcase_14 AC 723 ms
394,800 KB
testcase_15 AC 632 ms
394,556 KB
testcase_16 AC 667 ms
394,652 KB
testcase_17 AC 732 ms
394,816 KB
testcase_18 AC 637 ms
394,724 KB
testcase_19 AC 450 ms
394,696 KB
testcase_20 AC 773 ms
394,944 KB
testcase_21 AC 843 ms
394,648 KB
testcase_22 AC 570 ms
394,640 KB
testcase_23 AC 716 ms
394,704 KB
testcase_24 AC 362 ms
394,620 KB
testcase_25 AC 591 ms
394,740 KB
testcase_26 AC 486 ms
394,564 KB
testcase_27 AC 501 ms
394,560 KB
testcase_28 AC 960 ms
394,828 KB
testcase_29 AC 280 ms
394,412 KB
testcase_30 AC 279 ms
394,340 KB
testcase_31 AC 278 ms
394,216 KB
testcase_32 AC 277 ms
394,336 KB
testcase_33 AC 279 ms
394,400 KB
testcase_34 AC 280 ms
394,204 KB
testcase_35 AC 279 ms
394,240 KB
testcase_36 AC 280 ms
394,292 KB
testcase_37 AC 279 ms
394,304 KB
testcase_38 AC 338 ms
394,368 KB
testcase_39 AC 356 ms
394,436 KB
testcase_40 AC 541 ms
394,664 KB
testcase_41 AC 435 ms
394,464 KB
testcase_42 AC 334 ms
394,372 KB
testcase_43 AC 311 ms
394,360 KB
testcase_44 AC 508 ms
394,720 KB
testcase_45 AC 312 ms
394,368 KB
testcase_46 AC 322 ms
394,416 KB
testcase_47 AC 673 ms
394,676 KB
testcase_48 AC 392 ms
394,620 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