結果
| 問題 |
No.933 おまわりさんこいつです
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-01 20:34:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 731 bytes |
| コンパイル時間 | 335 ms |
| コンパイル使用メモリ | 82,728 KB |
| 実行使用メモリ | 261,148 KB |
| 最終ジャッジ日時 | 2025-03-01 20:34:58 |
| 合計ジャッジ時間 | 7,503 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 TLE * 2 |
ソースコード
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(2) # 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) # タイマー解除