結果
| 問題 |
No.790 ちきんの括弧並べ
|
| ユーザー |
ikd
|
| 提出日時 | 2019-02-20 22:24:33 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 1,983 ms / 2,000 ms |
| コード長 | 370 bytes |
| コンパイル時間 | 3,354 ms |
| コンパイル使用メモリ | 64,896 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-01 19:23:36 |
| 合計ジャッジ時間 | 6,368 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
import strutils, sequtils
proc main()=
let n = stdin.readLine.parseInt * 2
var ans = 0
for bits in 0..<(1 shl n):
var
cur = 0
ok = true
for i in 0..<n:
if (bits and (1 shl i)) > 0:
cur += 1
else:
cur -= 1
if cur < 0:
ok = false
break
if ok and (cur == 0):
ans += 1
echo ans
main()
ikd