結果
| 問題 |
No.129 お年玉(2)
|
| コンテスト | |
| ユーザー |
fiord
|
| 提出日時 | 2015-07-01 22:21:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 340 ms / 5,000 ms |
| コード長 | 466 bytes |
| コンパイル時間 | 2,618 ms |
| コンパイル使用メモリ | 157,940 KB |
| 実行使用メモリ | 343,424 KB |
| 最終ジャッジ日時 | 2024-11-28 00:00:40 |
| 合計ジャッジ時間 | 7,891 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define E 1000000000
int main(){
ll n,m; cin>>n>>m;
n/=1000;
n%=m;
if(n==0){
cout<<1<<endl;
return 0;
}
//mCnを求めれば良い
if(n>m/2) n=m-n;
ll dp[m][n+1];
for(int i=0;i<m;i++){
for(int j=0;j<=n;j++) dp[i][j]=1;
}
for(int i=1;i<m;i++){
for(int j=1;j<=min((ll)i,n);j++){
dp[i][j]=dp[i-1][j-1]+dp[i-1][j];
dp[i][j]%=E;
}
}
cout<<dp[m-1][n]<<endl;
return 0;
}
fiord