結果
| 問題 |
No.129 お年玉(2)
|
| コンテスト | |
| ユーザー |
nenuon
|
| 提出日時 | 2017-06-22 14:51:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 824 bytes |
| コンパイル時間 | 742 ms |
| コンパイル使用メモリ | 89,668 KB |
| 実行使用メモリ | 785,136 KB |
| 最終ジャッジ日時 | 2024-10-02 12:14:27 |
| 合計ジャッジ時間 | 31,207 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 3 |
| other | MLE * 46 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
long long dp[10001][10002];
int main(){
long long n, m;
cin >> n >> m;
n /= 1000;
n %= m;
FOR(i,0,10001){
FOR(j,0,10002){
dp[i][j] = 0;
}
}
dp[1][0] = dp[1][1] = 1;
FOR(i,1,10000){
FOR(j,0,10002){
if(j == 0) dp[i+1][j] = dp[i][j];
else if(j == i) dp[i+1][j] = dp[i][i-1];
else dp[i+1][j] = dp[i][j-1] + dp[i][j];
dp[i+1][j] %= 1000000000;
}
}
if(n==0){
cout << 1 << endl;
} else {
cout << dp[n][m] << endl;
}
return 0;
}
nenuon