結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2015-07-03 06:40:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 720 ms / 5,000 ms |
コード長 | 1,146 bytes |
コンパイル時間 | 598 ms |
コンパイル使用メモリ | 83,792 KB |
実行使用メモリ | 165,504 KB |
最終ジャッジ日時 | 2024-11-28 00:01:06 |
合計ジャッジ時間 | 14,185 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#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;const int maxC = 10000;LL c[maxC][maxC/2];LL ccc(LL n,LL k){LL ans;LL kk = min(k,n-k);if(n<maxC && kk < maxC && c[n][kk] != 0){ans = c[n][kk];}else if(kk ==0 ){if(n<maxC){c[n][kk] = 1;}ans = 1;}else if( kk==1){if(n<maxC){c[n][kk] = n%mod;}ans = n%mod;}else{ans = (ccc(n-1,kk-1)%mod+ccc(n-1,kk)%mod)%mod;if(n<maxC && kk < maxC){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,maxC)rep(j,maxC)c[i][j]=-1;//N C amaP(ccc(M,ama));return 0;}