結果
| 問題 |
No.790 ちきんの括弧並べ
|
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2019-02-21 02:34:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1,681 ms / 2,000 ms |
| コード長 | 609 bytes |
| コンパイル時間 | 1,994 ms |
| コンパイル使用メモリ | 157,928 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 16:36:38 |
| 合計ジャッジ時間 | 4,317 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n,l,r,c=0;
bool f;
cin >> n;
rep(i,1<<n*2) {
l=r=0;
f=false;
rep(j,n*2) {
if (i&(1<<j)) {
r++;
} else {
l++;
}
if (l<r) {
f=true;
break;
}
}
if (!f&&l==r) c++;
}
cout << c << endl;
return 0;
}
🍮かんプリン