結果

問題 No.432 占い(Easy)
コンテスト
ユーザー lam6er
提出日時 2025-03-20 21:07:06
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 439 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 228 ms
コンパイル使用メモリ 95,980 KB
実行使用メモリ 83,932 KB
最終ジャッジ日時 2026-07-07 12:50:47
合計ジャッジ時間 3,379 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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