結果

問題 No.129 お年玉(2)
ユーザー mint6421mint6421
提出日時 2019-07-02 23:57:51
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,133 bytes
コンパイル時間 1,226 ms
コンパイル使用メモリ 148,480 KB
実行使用メモリ 6,416 KB
最終ジャッジ日時 2023-10-11 21:12:49
合計ジャッジ時間 8,337 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 2 ms
4,352 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 1 ms
4,352 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 5 ms
5,836 KB
testcase_34 AC 2 ms
4,352 KB
testcase_35 AC 3 ms
5,312 KB
testcase_36 AC 4 ms
5,692 KB
testcase_37 AC 5 ms
6,416 KB
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:44:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main(){
      ^

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}

vector<vector<int>> paskal(int n){
  vector<vector<int>> c(n+1,vector<int>(n+1,0));

  rep(i,n+1){
    rep(j,n+1){
      if(j>i) break;
      if(i==0||j==0) c[i][j]=1;
      else c[i][j]=c[i-1][j-1]+c[i-1][j];
      c[i][j]%=M;
    }
  }

  return c;
}

main(){
  int n,m;
  cin>>n>>m;

  int k=(n/1000)%m;

  vector<vector<int>> c=paskal(m);

  /*
  rep(i,10){
    rep(j,10){
      cout<<c[i][j]<<' ';
    }
    cout<<endl;
  }
  */

  cout<<c[m][k]<<endl;

}
0