結果
| 問題 | No.434 占い |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-15 00:31:13 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 563 bytes |
| 記録 | |
| コンパイル時間 | 422 ms |
| コンパイル使用メモリ | 77,492 KB |
| 最終ジャッジ日時 | 2025-12-03 22:06:53 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 11 MLE * 1 -- * 15 |
ソースコード
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll
def pascal(n):
line = [1]
for k in xrange(n):
line.append(line[k]*(n - k)/(k + 1))
return line
T = int(raw_input())
for loop in xrange(T):
S = raw_input()
N = len(S)
if N == 1:
print S
continue
p = pascal(N - 1)
X = 0
for i, s in enumerate(S):
X += int(s)*p[i]
ans = 0
for x in str(X):
ans = ans + int(x)
if ans >= 10:
ans = ans%10 + 1
print ans