結果
問題 |
No.790 ちきんの括弧並べ
|
ユーザー |
![]() |
提出日時 | 2019-08-28 18:34:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 756 bytes |
コンパイル時間 | 786 ms |
コンパイル使用メモリ | 92,304 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-17 16:27:49 |
合計ジャッジ時間 | 1,508 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <unordered_map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; int main() { int N; cin >> N; long long dp[14*2][14] = {0}; dp[0][0] = 1; for ( int i = 0; i < N*2; i++ ) { for ( int j = 0; j <= N; j++ ) { if ( j+1 <= N && (i+2)/2 <= j+1 ) { dp[i+1][j+1] += dp[i][j]; } if ( i-j < N && (i+2)/2 <= j ) { dp[i+1][j] += dp[i][j]; } } } cout << dp[2*N][N] << endl; return 0; }