結果

問題 No.432 占い(Easy)
ユーザー maspy
提出日時 2020-01-19 02:40:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 463 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,668 KB
最終ジャッジ日時 2024-06-28 17:48:38
合計ジャッジ時間 13,467 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

T = int(readline())
S = readlines()

answer = []
for s in S:
    A = np.array(list(s.decode().rstrip()),np.int32)
    if np.all(A == 0):
        answer.append(0)
        continue
    while len(A) > 1:
        A = (A[:-1] + A[1:]) % 9
    x = A[0]
    if not x:
        x = 9
    answer.append(x)

print('\n'.join(map(str,answer)))
0