結果

問題 No.432 占い(Easy)
ユーザー nanae
提出日時 2017-02-17 17:11:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 639 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 15,360 KB
最終ジャッジ日時 2024-12-30 23:00:56
合計ジャッジ時間 2,725 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    T = int(input())
    for test in range(T):
        S = [int(i) for i in input()]
        # debug(S, locals())
        ans = uranai(S)
        print(ans)

def uranai(S):
    if len(S) == 1:
        return S[0]
    else:
        S = [S[i] + S[i + 1] for i in range(len(S) - 1)]
        for i in range(len(S)):
            if S[i] >= 10:
                S[i] = 1 + S[i] % 10
        return uranai(S)

if __name__ == '__main__':
    solve()
0