結果

問題 No.129 お年玉(2)
ユーザー mint6421mint6421
提出日時 2019-07-02 23:59:29
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 425 ms / 5,000 ms
コード長 1,140 bytes
コンパイル時間 3,192 ms
コンパイル使用メモリ 147,896 KB
実行使用メモリ 394,056 KB
最終ジャッジ日時 2023-08-18 18:19:43
合計ジャッジ時間 13,889 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
22,392 KB
testcase_01 AC 425 ms
394,056 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 179 ms
162,192 KB
testcase_06 AC 279 ms
256,704 KB
testcase_07 AC 339 ms
314,464 KB
testcase_08 AC 234 ms
214,436 KB
testcase_09 AC 316 ms
289,472 KB
testcase_10 AC 351 ms
325,996 KB
testcase_11 AC 227 ms
205,532 KB
testcase_12 AC 292 ms
268,660 KB
testcase_13 AC 306 ms
281,068 KB
testcase_14 AC 296 ms
271,560 KB
testcase_15 AC 244 ms
223,116 KB
testcase_16 AC 276 ms
253,856 KB
testcase_17 AC 334 ms
308,384 KB
testcase_18 AC 318 ms
290,468 KB
testcase_19 AC 339 ms
310,064 KB
testcase_20 AC 334 ms
307,596 KB
testcase_21 AC 415 ms
384,716 KB
testcase_22 AC 237 ms
216,968 KB
testcase_23 AC 362 ms
335,936 KB
testcase_24 AC 348 ms
322,644 KB
testcase_25 AC 226 ms
206,968 KB
testcase_26 AC 233 ms
211,956 KB
testcase_27 AC 225 ms
205,620 KB
testcase_28 AC 417 ms
388,644 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 4 ms
5,708 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 4 ms
5,440 KB
testcase_36 AC 5 ms
5,668 KB
testcase_37 AC 5 ms
6,464 KB
testcase_38 AC 48 ms
44,764 KB
testcase_39 AC 75 ms
67,656 KB
testcase_40 AC 210 ms
191,964 KB
testcase_41 AC 129 ms
117,032 KB
testcase_42 AC 54 ms
50,520 KB
testcase_43 AC 53 ms
49,708 KB
testcase_44 AC 420 ms
390,792 KB
testcase_45 AC 30 ms
28,376 KB
testcase_46 AC 83 ms
75,632 KB
testcase_47 AC 405 ms
377,396 KB
testcase_48 AC 250 ms
226,492 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:45: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(){
  ll n;
  int 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