結果

問題 No.73 helloworld
ユーザー lllllll88938494lllllll88938494
提出日時 2022-02-12 01:28:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 627 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-09-10 09:09:57
合計ジャッジ時間 1,322 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,776 KB
testcase_01 AC 20 ms
7,732 KB
testcase_02 AC 16 ms
7,828 KB
testcase_03 AC 16 ms
7,908 KB
testcase_04 AC 16 ms
7,912 KB
testcase_05 AC 16 ms
7,860 KB
testcase_06 AC 16 ms
7,972 KB
testcase_07 AC 17 ms
7,904 KB
testcase_08 AC 16 ms
7,860 KB
testcase_09 AC 16 ms
7,732 KB
testcase_10 AC 16 ms
7,776 KB
testcase_11 AC 16 ms
7,972 KB
testcase_12 AC 16 ms
7,804 KB
testcase_13 AC 17 ms
7,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ns=[0]*26

for i in range(26):
    t=int(input())
    ns[i]=t

def  cal(x):
    t=1
    for i in range(x-1,0,-1):
        t=max(t,(i*(i-1)) // 2 * (x-i))
    return t
  
def  cal2(x):
    t=1
    for i in range(x-1,0,-1):
        t=max(t,i*(x-i))
    return t

s='helowrd'
ss='helloworld'
ans=1

for i in range(len(s)):
   
    if ns[ord(s[i])%97] < ss.count(s[i]):
        ans=0
        break
    else:
        if s[i] == 'l':
            t = cal(ns[ord(s[i])%97])
        elif s[i] == 'o':
            t = cal2(ns[ord(s[i])%97])
        else:
            t = ns[ord(s[i])%97]
            
        ans *= t
        
print(ans)
0