結果

問題 No.145 yukiover
ユーザー titia
提出日時 2022-03-10 00:52:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 258 ms / 5,000 ms
コード長 1,186 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-09-14 02:18:18
合計ジャッジ時間 3,657 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N=int(input())
S=input().strip()

C=Counter(S)
ANS=0

ALL="abcdefghijklmnopqrstuvwxyz"
YUKI="yuki"

for i in range(10**6):
    #print(C)

    if C["y"]>0 and C["u"]>0 and C["k"]>0 and C["i"]>0:
        C["y"]-=1
        C["u"]-=1
        C["k"]-=1
        C["i"]-=1
        
        for s in ALL:
            if C[s]>0:
                C[s]-=1
                ANS+=1
                break

        continue

    if C["y"]>0 and C["u"]>0 and C["k"]>0:
        C["y"]-=1
        C["u"]-=1
        C["k"]-=1
        
        for s in ALL:
            if s>"i" and C[s]>0:
                C[s]-=1
                ANS+=1
                break

        continue

    if C["y"]>0 and C["u"]>0:
        C["y"]-=1
        C["u"]-=1
        
        for s in ALL:
            if s>"k" and C[s]>0:
                C[s]-=1
                ANS+=1
                break
        continue

    if C["y"]>0:
        C["y"]-=1
        
        for s in ALL:
            if s>"u" and C[s]>0:
                C[s]-=1
                ANS+=1
                break

        continue

    if C["z"]>0:
        C["z"]-=1
        ANS+=1
    else:
        break

    

print(ANS)
0