結果
| 問題 |
No.129 お年玉(2)
|
| コンテスト | |
| ユーザー |
tetsuzuki1115
|
| 提出日時 | 2018-10-13 18:38:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 593 ms / 5,000 ms |
| コード長 | 752 bytes |
| コンパイル時間 | 1,096 ms |
| コンパイル使用メモリ | 91,956 KB |
| 実行使用メモリ | 165,888 KB |
| 最終ジャッジ日時 | 2024-11-28 01:11:47 |
| 合計ジャッジ時間 | 12,079 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
long long C[10001][10001];
long long func( int n, int r ) {
if ( n/2 < r ) { r = n-r; }
if ( r == 0 ) { return 1; }
if ( C[n][r] > 0 ) { return C[n][r]; }
C[n][r] = ( func( n-1, r ) + func( n-1, r-1 ) ) % ( (long long)1e9 );
return C[n][r];
}
int main() {
long long N,M;
cin >> N >> M;
int a = (N/1000)%M;
long long ans = func( M, a );
cout << ans << endl;
return 0;
}
tetsuzuki1115