結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2015-01-24 01:25:02 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 240 ms / 5,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 9,821 ms |
コンパイル使用メモリ | 409,836 KB |
実行使用メモリ | 236,800 KB |
最終ジャッジ日時 | 2024-09-27 12:23:03 |
合計ジャッジ時間 | 16,726 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <iostream> #include <algorithm> #include <sstream> #include <cstdio> using namespace std; #define COMBSZ 10001 #define MOD 1000000000LL typedef long long LL; int main(int argc, char *argv[]) { static int C[COMBSZ][COMBSZ] = { 1 }; string s; getline(cin, s); LL N, M; stringstream ss(s); ss >> N; getline(cin, s); M = atoi(s.c_str()); N /= 1000; N %= M; for (LL i = 1; i <= M; ++i) { C[i][0] = 1; for (LL j = 1; j <= i; ++j) { C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD; } } LL ans = C[M][M-N]; cout << ans << endl; return 0; }