結果
問題 | No.790 ちきんの括弧並べ |
ユーザー | kekurema |
提出日時 | 2019-03-17 21:28:16 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,104 bytes |
コンパイル時間 | 2,119 ms |
コンパイル使用メモリ | 100,496 KB |
実行使用メモリ | 23,296 KB |
最終ジャッジ日時 | 2023-09-22 03:45:29 |
合計ジャッジ時間 | 7,307 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 58 ms
20,860 KB |
testcase_01 | AC | 60 ms
21,156 KB |
testcase_02 | AC | 59 ms
21,192 KB |
testcase_03 | AC | 58 ms
21,116 KB |
testcase_04 | AC | 58 ms
21,212 KB |
testcase_05 | AC | 61 ms
23,252 KB |
testcase_06 | AC | 67 ms
21,156 KB |
testcase_07 | AC | 95 ms
23,212 KB |
testcase_08 | AC | 657 ms
21,216 KB |
testcase_09 | TLE | - |
testcase_10 | AC | 56 ms
21,152 KB |
testcase_11 | AC | 56 ms
21,248 KB |
testcase_12 | AC | 200 ms
21,112 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace contest { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); Console.WriteLine(Count(N)); } static public int Count(int N) { int min = (int)Math.Pow(2, N) - 1; int max = (int)Math.Pow(2, N * 2); int patCnt = 0; for (int i = min; i < max; i++) { int t = i; int cnt0 = 0; int cnt1 = 0; int n = 0; bool isOk = true; for (; n < N * 2 ; n++) { if ((t & 1) == 1) cnt1++; else cnt0++; if (cnt0 > cnt1 || cnt1 > N) { isOk = false; break; } t >>= 1; } if (isOk) { patCnt++; } } return patCnt; } } }