結果

問題 No.145 yukiover
ユーザー roiti46roiti46
提出日時 2015-02-19 17:07:03
言語 Python2
(2.7.18)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 1,014 bytes
コンパイル時間 63 ms
コンパイル使用メモリ 6,728 KB
実行使用メモリ 6,172 KB
最終ジャッジ日時 2023-09-06 02:24:16
合計ジャッジ時間 1,885 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,012 KB
testcase_01 AC 10 ms
6,100 KB
testcase_02 AC 10 ms
5,948 KB
testcase_03 AC 11 ms
5,888 KB
testcase_04 AC 11 ms
5,864 KB
testcase_05 AC 11 ms
5,952 KB
testcase_06 AC 11 ms
5,932 KB
testcase_07 AC 11 ms
5,852 KB
testcase_08 AC 11 ms
6,076 KB
testcase_09 AC 11 ms
5,948 KB
testcase_10 AC 11 ms
6,112 KB
testcase_11 AC 23 ms
5,960 KB
testcase_12 AC 49 ms
5,944 KB
testcase_13 AC 53 ms
5,988 KB
testcase_14 AC 55 ms
5,960 KB
testcase_15 AC 59 ms
6,172 KB
testcase_16 AC 50 ms
5,944 KB
testcase_17 AC 51 ms
5,992 KB
testcase_18 AC 51 ms
6,108 KB
testcase_19 AC 52 ms
5,964 KB
testcase_20 AC 52 ms
6,128 KB
testcase_21 AC 52 ms
6,172 KB
testcase_22 AC 52 ms
5,960 KB
testcase_23 AC 36 ms
5,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(raw_input())
S = raw_input()
num = [0]*10
for s in S:
    if   s  < "i": num[0] += 1
    elif s == "i": num[1] += 1
    elif s  < "k": num[2] += 1
    elif s == "k": num[3] += 1
    elif s  < "u": num[4] += 1
    elif s == "u": num[5] += 1
    elif s  < "y": num[6] += 1
    elif s == "y": num[7] += 1
    elif s  > "y": num[8] += 1

ans = 0
ans += num[8]
while num[7]:
    num[7] -= 1
    if   num[6] > 0: num[6] -= 1; ans += 1; continue
    elif num[5] > 0:
        num[5] -= 1
        if   num[4] > 0: num[4] -= 1; ans += 1; continue
        elif num[3] > 0:
            num[3] -= 1
            if   num[2] > 0: num[2] -= 1; ans += 1; continue
            elif num[1] > 0:
                num[1] -= 1
                if num[0] > 0: num[0] -= 1; ans += 1; continue

                if num[1] > 0: num[1] -= 1; ans += 1; continue
            if num[3] > 0: num[3] -= 1; ans += 1; continue
        if num[5] > 0: num[5] -= 1; ans += 1; continue
    if num[7] > 0: num[7] -= 1; ans += 1; continue
print ans
0