結果
問題 |
No.287 場合の数
|
ユーザー |
![]() |
提出日時 | 2016-07-19 19:04:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 702 ms / 5,000 ms |
コード長 | 1,244 bytes |
コンパイル時間 | 1,692 ms |
コンパイル使用メモリ | 158,056 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 00:27:26 |
合計ジャッジ時間 | 9,103 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; namespace { typedef double real; typedef long long ll; template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) { if (vs.empty()) return os << "[]"; os << "[" << vs[0]; for (int i = 1; i < vs.size(); i++) os << " " << vs[i]; return os << "]"; } template<class T> istream& operator>>(istream& is, vector<T>& vs) { for (auto it = vs.begin(); it != vs.end(); it++) is >> *it; return is; } int N; void input() { cin >> N; } const int MAX_K = 502; ll comb(int k) { static ll dp[6 + 1][MAX_K]; memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for (int i = 0; i < 6; i++) { for (int j = 0; j <= N; j++) { for (int t = 0; t <= k; t++) { dp[i + 1][t + j] += dp[i][t]; } } } return dp[6][k]; } void solve() { ll ans = 0; for (int h = 0; h <= N; h++) { for (int g = 0; g <= N; g++) { ans += comb(h + g); } } cout << ans << endl; } } int main() { input(); solve(); return 0; }