結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2016-02-26 16:36:45 |
言語 | C++11 (gcc 13.3.0) |
結果 |
MLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 984 bytes |
コンパイル時間 | 612 ms |
コンパイル使用メモリ | 74,372 KB |
実行使用メモリ | 750,960 KB |
最終ジャッジ日時 | 2024-11-21 11:00:58 |
合計ジャッジ時間 | 19,949 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 MLE * 28 |
ソースコード
#include <cstdio> #include <iostream> #include <algorithm> #include <complex> #include <queue> #include <map> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define FORR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define pb push_back #define ALL(a) (a).begin(),(a).end() #define EPS (1e-10) #define EQ(a,b) (abs((a)-(b)) < EPS) #define PI 3.1415926535 typedef long long ll; typedef pair<int, int> P; //typedef complex<double> C; const int MAX_M = 10000; ll mod = 1000000000; ll N, M; ll C[MAX_M + 1][MAX_M + 1]; void input() { cin >> N >> M; } void setPascal(int N) { REP(i, N + 1) { C[i][0] = C[i][i] = 1; } FOR(i, 1, N + 1) { FOR(j, 1, i) { C[i][j] = (C[i-1][j-1] + C[i-1][j]) % mod; } } } void solve() { N /= 1000; if (N == 0) { cout << 1 << endl; return; } int r = N % M; setPascal(M); cout << C[M][r] << endl; } int main() { input(); solve(); }