結果

問題 No.432 占い(Easy)
ユーザー hiragnhiragn
提出日時 2022-11-09 19:18:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 289 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 29,828 KB
最終ジャッジ日時 2023-09-30 06:50:14
合計ジャッジ時間 6,627 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
29,732 KB
testcase_01 AC 114 ms
29,464 KB
testcase_02 AC 117 ms
29,400 KB
testcase_03 AC 118 ms
29,584 KB
testcase_04 AC 170 ms
29,628 KB
testcase_05 AC 120 ms
29,580 KB
testcase_06 AC 115 ms
29,560 KB
testcase_07 AC 119 ms
29,648 KB
testcase_08 AC 116 ms
29,508 KB
testcase_09 AC 119 ms
29,440 KB
testcase_10 AC 132 ms
29,572 KB
testcase_11 AC 156 ms
29,644 KB
testcase_12 AC 285 ms
29,700 KB
testcase_13 AC 281 ms
29,744 KB
testcase_14 AC 148 ms
29,596 KB
testcase_15 AC 124 ms
29,528 KB
testcase_16 AC 116 ms
29,700 KB
testcase_17 AC 289 ms
29,688 KB
testcase_18 AC 207 ms
29,828 KB
testcase_19 AC 180 ms
29,748 KB
testcase_20 AC 153 ms
29,808 KB
testcase_21 AC 156 ms
29,748 KB
testcase_22 AC 135 ms
29,544 KB
testcase_23 AC 124 ms
29,504 KB
testcase_24 AC 119 ms
29,540 KB
testcase_25 AC 123 ms
29,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np


def f(x: int) -> int:
    return x % 10 + x // 10


def main():
    t = int(input())
    for _ in range(t):
        arr = np.array(list(map(int, list(input()))))
        while len(arr) > 1:
            tmp = np.add(arr, np.roll(arr, -1))
            arr = np.array([f(x) for x in tmp[:-1]])
        print(arr[0])


if __name__ == "__main__":
    main()
0