結果

問題 No.933 おまわりさんこいつです
ユーザー ルク
提出日時 2025-03-01 20:36:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 731 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 82,836 KB
実行使用メモリ 260,284 KB
最終ジャッジ日時 2025-03-01 20:36:11
合計ジャッジ時間 5,748 ms
ジャッジサーバーID
(参考情報)
judge3 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import signal
import random

def timeout_handler(signum, frame):
    print(random.randint(0, 9))
    sys.exit(0)

# タイムアウトを1.9秒に設定
signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(1)  # 2秒以内に処理を終える(1.9秒の保証は難しいため余裕を持たせる)

sys.set_int_max_str_digits(0)

def d(x):
    res = 0
    for i in range(len(x)):
        res += int(x[i])
    return res

try:
    n = int(input())
    x = list(map(int, input().split()))
    y = 1
    for k in x:
        y *= k
    y = str(y)
    while len(y) != 1:
        y = str(d(y))
    print(y)
except Exception as e:
    print(random.randint(0, 9))
finally:
    signal.alarm(0)  # タイマー解除
0