結果

問題 No.434 占い
ユーザー roiti46roiti46
提出日時 2016-10-15 00:31:13
言語 Python2
(2.7.18)
結果
MLE  
実行時間 -
コード長 563 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 6,672 KB
実行使用メモリ 593,280 KB
最終ジャッジ日時 2023-08-14 12:05:43
合計ジャッジ時間 5,279 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
14,952 KB
testcase_01 AC 25 ms
7,744 KB
testcase_02 AC 23 ms
7,928 KB
testcase_03 AC 23 ms
7,772 KB
testcase_04 AC 23 ms
7,948 KB
testcase_05 AC 23 ms
7,976 KB
testcase_06 AC 24 ms
7,788 KB
testcase_07 AC 24 ms
7,784 KB
testcase_08 AC 92 ms
17,688 KB
testcase_09 AC 39 ms
8,056 KB
testcase_10 AC 34 ms
7,872 KB
testcase_11 AC 35 ms
7,788 KB
testcase_12 AC 38 ms
7,900 KB
testcase_13 AC 92 ms
17,796 KB
testcase_14 AC 39 ms
8,148 KB
testcase_15 MLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- 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
0