結果

問題 No.432 占い(Easy)
ユーザー nanaenanae
提出日時 2017-02-17 17:11:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 639 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 12,856 KB
最終ジャッジ日時 2023-08-29 07:08:42
合計ジャッジ時間 3,385 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,864 KB
testcase_01 AC 15 ms
7,848 KB
testcase_02 AC 15 ms
7,940 KB
testcase_03 AC 15 ms
7,840 KB
testcase_04 AC 16 ms
7,856 KB
testcase_05 AC 15 ms
7,796 KB
testcase_06 AC 16 ms
7,800 KB
testcase_07 AC 16 ms
7,820 KB
testcase_08 AC 17 ms
7,872 KB
testcase_09 AC 21 ms
7,800 KB
testcase_10 AC 17 ms
7,936 KB
testcase_11 AC 24 ms
7,832 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 23 ms
7,804 KB
testcase_15 AC 16 ms
7,800 KB
testcase_16 AC 16 ms
7,808 KB
testcase_17 RE -
testcase_18 AC 51 ms
9,360 KB
testcase_19 AC 38 ms
8,664 KB
testcase_20 AC 26 ms
8,488 KB
testcase_21 AC 28 ms
8,732 KB
testcase_22 AC 18 ms
7,900 KB
testcase_23 AC 19 ms
7,876 KB
testcase_24 AC 20 ms
7,996 KB
testcase_25 AC 20 ms
7,800 KB
権限があれば一括ダウンロードができます

ソースコード

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