結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2019-07-07 19:59:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 841 bytes |
コンパイル時間 | 1,017 ms |
コンパイル使用メモリ | 108,148 KB |
実行使用メモリ | 769,008 KB |
最終ジャッジ日時 | 2024-12-20 09:26:55 |
合計ジャッジ時間 | 11,561 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 MLE * 28 |
ソースコード
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <list> #include <set> #include <map> #include <numeric> #include <regex> #include <tuple> #include <iomanip> #include <cmath> using namespace std; typedef long long ll; typedef pair<int, int> P; #define MOD 1000000007 // 10^9 + 7 #define INF 1000000000 // 10^9 #define LLINF 1LL<<60 ll Com[10009][10009]; // C[n][k] = nCk void combination_table(int N) { for (int i = 0; i <= N; i++) { for (int j = 0; j <= i; j++) { if (j == 0 || j == i) Com[i][j] = 1LL; else Com[i][j] = (Com[i - 1][j] + Com[i - 1][j - 1]) % INF; } } } int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, M; cin >> N >> M; N /= 1000; N = N % M; combination_table(M); cout << Com[M][min(N, M - N)] << endl; return 0; }