結果
| 問題 |
No.1011 Infinite Stairs
|
| コンテスト | |
| ユーザー |
Plan8
|
| 提出日時 | 2020-03-20 21:52:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,796 bytes |
| コンパイル時間 | 1,903 ms |
| コンパイル使用メモリ | 168,728 KB |
| 実行使用メモリ | 221,840 KB |
| 最終ジャッジ日時 | 2024-12-15 05:29:09 |
| 合計ジャッジ時間 | 22,531 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 TLE * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)
#define en "\n"
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;
#define CLR(a) memset((a), 0, sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(void){
ll N,d,K; cin >> N >> d >> K;
ll dp[N+1][K+1]; REP(i,N+1)REP(j,K+1) dp[i][j] = 0;
dp[0][0] = 1;
REP(i,N)REP(j,K){
if(dp[i][j] > 0){
REP(k,d){
if(j+k+1 > K) break;
dp[i+1][j+k+1] = (dp[i+1][j+k+1] + dp[i][j])%MOD;
}
}
}
ll ans = dp[N][K];
cout << ans << en;
return 0;
}
Plan8