結果
問題 |
No.129 お年玉(2)
|
ユーザー |
![]() |
提出日時 | 2015-07-03 06:27:37 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,041 bytes |
コンパイル時間 | 795 ms |
コンパイル使用メモリ | 83,932 KB |
実行使用メモリ | 16,128 KB |
最終ジャッジ日時 | 2024-07-07 22:40:04 |
合計ジャッジ時間 | 13,076 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | TLE * 1 -- * 45 |
ソースコード
#define _USE_MATH_DEFINES #include <iostream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <list> #include <queue> #include <vector> #include <complex> #include <set> ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)<<endl; ///////// typedef long long LL; typedef long double LD; ///////// using namespace::std; ///////// const LL mod = (LL)1e9; LL c[1000][1000]; LL ccc(LL n,LL k){ LL kk = min(k,n-k); if(kk ==0 ){ return 1; }else if( kk==1){ return n%mod; }else if(n<1000 && kk < 1000 && c[n][kk] != -1){ return c[n][kk]; } //////// LL ans; ans = (ccc(n-1,kk-1)%mod+ccc(n-1,kk)%mod)%mod; if(n<1000 && kk < 1000){ c[n][kk] = ans; } return ans; } int main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;// //cout << setprecision(6);// LL N,M; cin>>N>>M; LL ama = (N%(M*1000))/1000; rep(i,1000)rep(j,1000)c[i][j]=-1; //N C ama P(ccc(M,ama)); return 0; }