結果

問題 No.129 お年玉(2)
ユーザー mint6421mint6421
提出日時 2019-07-02 23:59:29
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 364 ms / 5,000 ms
コード長 1,140 bytes
コンパイル時間 1,252 ms
コンパイル使用メモリ 161,916 KB
実行使用メモリ 394,368 KB
最終ジャッジ日時 2024-05-06 00:04:33
合計ジャッジ時間 10,210 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
22,656 KB
testcase_01 AC 351 ms
394,368 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 149 ms
162,560 KB
testcase_06 AC 233 ms
256,768 KB
testcase_07 AC 283 ms
314,752 KB
testcase_08 AC 195 ms
214,528 KB
testcase_09 AC 264 ms
289,792 KB
testcase_10 AC 294 ms
326,272 KB
testcase_11 AC 188 ms
205,696 KB
testcase_12 AC 247 ms
268,800 KB
testcase_13 AC 266 ms
281,344 KB
testcase_14 AC 246 ms
271,488 KB
testcase_15 AC 202 ms
223,616 KB
testcase_16 AC 229 ms
254,080 KB
testcase_17 AC 279 ms
308,608 KB
testcase_18 AC 269 ms
290,688 KB
testcase_19 AC 282 ms
310,272 KB
testcase_20 AC 279 ms
307,840 KB
testcase_21 AC 355 ms
384,896 KB
testcase_22 AC 203 ms
216,832 KB
testcase_23 AC 307 ms
336,384 KB
testcase_24 AC 289 ms
322,688 KB
testcase_25 AC 189 ms
206,976 KB
testcase_26 AC 191 ms
212,096 KB
testcase_27 AC 191 ms
205,440 KB
testcase_28 AC 357 ms
389,120 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 3 ms
5,632 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 3 ms
5,504 KB
testcase_36 AC 4 ms
5,888 KB
testcase_37 AC 5 ms
6,400 KB
testcase_38 AC 39 ms
44,672 KB
testcase_39 AC 58 ms
67,968 KB
testcase_40 AC 176 ms
192,000 KB
testcase_41 AC 105 ms
117,120 KB
testcase_42 AC 43 ms
50,816 KB
testcase_43 AC 40 ms
49,792 KB
testcase_44 AC 364 ms
391,040 KB
testcase_45 AC 23 ms
28,672 KB
testcase_46 AC 64 ms
75,904 KB
testcase_47 AC 344 ms
377,472 KB
testcase_48 AC 204 ms
226,432 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:45:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   45 | 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