結果
問題 | No.73 helloworld |
ユーザー | nbisco |
提出日時 | 2017-01-11 00:36:29 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 21 ms / 5,000 ms |
コード長 | 810 bytes |
コンパイル時間 | 115 ms |
コンパイル使用メモリ | 10,904 KB |
実行使用メモリ | 8,760 KB |
最終ジャッジ日時 | 2023-09-12 09:41:19 |
合計ジャッジ時間 | 1,168 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 20 ms
8,588 KB |
testcase_01 | AC | 20 ms
8,696 KB |
testcase_02 | AC | 20 ms
8,760 KB |
testcase_03 | AC | 20 ms
8,604 KB |
testcase_04 | AC | 20 ms
8,640 KB |
testcase_05 | AC | 20 ms
8,668 KB |
testcase_06 | AC | 20 ms
8,700 KB |
testcase_07 | AC | 20 ms
8,636 KB |
testcase_08 | AC | 20 ms
8,752 KB |
testcase_09 | AC | 20 ms
8,636 KB |
testcase_10 | AC | 21 ms
8,736 KB |
testcase_11 | AC | 20 ms
8,712 KB |
testcase_12 | AC | 20 ms
8,660 KB |
testcase_13 | AC | 20 ms
8,612 KB |
ソースコード
import functools def comb(n, r): denom = functools.reduce(lambda x,y: x*y, [i for i in range(n-r+1,n+1)]) numer = functools.reduce(lambda x,y: x*y, [i for i in range(1,r+1)]) return denom // numer alpha = [int(input()) for i in range(ord("z")-ord("a")+1)] h = alpha[ord("h")-ord("a")] e = alpha[ord("e")-ord("a")] l = alpha[ord("l")-ord("a")] o = alpha[ord("o")-ord("a")] w = alpha[ord("w")-ord("a")] r = alpha[ord("r")-ord("a")] d = alpha[ord("d")-ord("a")] total = h*e*w*r*d if o > 2: total *= ((o-2)//2+1) * (o-2-((o-2)//2)+1) elif o == 2: pass else: total *= 0 if l > 3: max_l = 3 for i in range((l-3)+1): tmp = comb(2+i, 2) * (l-3-i+1) if tmp > max_l: max_l = tmp total *= max_l elif l == 3: pass else: total *= 0 print(total)