結果

問題 No.2201 p@$$w0rd
ユーザー lam6er
提出日時 2025-03-20 20:30:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,343 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 82,448 KB
実行使用メモリ 54,504 KB
最終ジャッジ日時 2025-03-20 20:32:08
合計ジャッジ時間 2,062 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input().strip()

total = 1
for c in S:
    if c in {'a', 'l', 'o', 's'}:
        total *= 2

def calculate_A(s):
    for c in s:
        if c not in {'a', 'l', 'o', 's'}:
            return 0
    return 1  # All characters are a, l, o, s and all are replaced

def calculate_B(s):
    has_l_or_o = any(c in {'l', 'o'} for c in s)
    if not has_l_or_o:
        return total
    res = 1
    for c in s:
        if c == 'l':
            res *= 1
        elif c == 'o':
            res *= 1
        elif c == 'a':
            res *= 2
        elif c == 's':
            res *= 2
        else:
            res *= 1
    return res

def calculate_C(s):
    has_a_or_s = any(c in {'a', 's'} for c in s)
    if not has_a_or_s:
        return total
    res = 1
    for c in s:
        if c == 'a':
            res *= 1
        elif c == 's':
            res *= 1
        elif c == 'l':
            res *= 2
        elif c == 'o':
            res *= 2
        else:
            res *= 1
    return res

def calculate_BC(s):
    res = 1
    for c in s:
        res *= 1
    return res

A = calculate_A(S)
B = calculate_B(S)
C = calculate_C(S)

AB = 0
if A != 0:
    has_l_or_o = any(c in {'l', 'o'} for c in S)
    if not has_l_or_o:
        AB = A
AC = 0

BC = calculate_BC(S)
ABC = 0

valid = total - (A + B + C) + (AB + AC + BC) - ABC

print(valid)
0