結果

問題 No.432 占い(Easy)
ユーザー lam6er
提出日時 2025-03-20 21:07:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 75,896 KB
最終ジャッジ日時 2025-03-20 21:07:10
合計ジャッジ時間 2,448 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

def fortune_telling(s):
    current = [int(c) for c in s]
    while len(current) > 1:
        next_current = []
        for i in range(len(current) - 1):
            total = current[i] + current[i + 1]
            if total >= 10:
                total -= 9
            next_current.append(total)
        current = next_current
    return current[0]

T = int(input())
for _ in range(T):
    S = input().strip()
    print(fortune_telling(S))
0