結果
| 問題 | No.73 helloworld |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-23 17:32:59 |
| 言語 | Nim (2.2.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 799 bytes |
| コンパイル時間 | 2,453 ms |
| コンパイル使用メモリ | 61,684 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-01 10:34:28 |
| 合計ジャッジ時間 | 3,089 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 4 |
ソースコード
import sequtils
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
while true:
let k = getchar_unlocked()
if k < '0': break
result = 10 * result + k.ord - '0'.ord
let C = newSeqWith(1 + 'Z'.ord - 'A'.ord,scan())
proc get(c:char):int = C[c.ord - 'A'.ord]
let S : seq[tuple[cnt,req:int]] = @[
(get('H'),1),
(get('E'),1),
(get('L'),3),
(get('O'),2),
(get('W'),1),
(get('R'),1),
(get('D'),1),
]
for s in S:
if s.cnt >= s.req : continue
quit "0",0
var ans = 1
for s in S:
if s.req == 1: ans *= s.cnt
elif s.req == 2:
ans *= (s.cnt div 2) * (s.cnt div 2 + s.cnt mod 2)
elif s.req == 3:
var tmp = 1
for x in 2..<s.cnt:
tmp = tmp.max(x * (x-1) * (s.cnt-x) div 2)
ans *= tmp
continue
echo ans