結果

問題 No.432 占い(Easy)
ユーザー konabekonabe
提出日時 2018-07-09 21:49:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 382 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 12,820 KB
最終ジャッジ日時 2023-09-23 04:03:19
合計ジャッジ時間 2,177 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,912 KB
testcase_01 AC 18 ms
7,968 KB
testcase_02 AC 17 ms
7,832 KB
testcase_03 AC 16 ms
7,828 KB
testcase_04 AC 17 ms
7,952 KB
testcase_05 WA -
testcase_06 AC 16 ms
7,988 KB
testcase_07 AC 16 ms
7,964 KB
testcase_08 AC 16 ms
8,028 KB
testcase_09 AC 20 ms
7,840 KB
testcase_10 WA -
testcase_11 AC 25 ms
7,808 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 16 ms
7,996 KB
testcase_18 AC 69 ms
9,516 KB
testcase_19 AC 50 ms
8,748 KB
testcase_20 AC 30 ms
8,296 KB
testcase_21 AC 33 ms
8,700 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 19 ms
8,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def add(x, y):
    z = x + y
    if z >= 10:
        return z % 10 + z // 10
    else:
        return z

def shrink(x):
    if len(x) == 1:
        return x[0]
    else:
        r = [add(x[i], x[i+1]) for i in range(len(x)-1)]
        return shrink(r)

T = int(input())
S = [[int (j) for j in list(str(int(input())))] for i in range(T)]
for s in S:
    print(shrink(s))
0