結果

問題 No.432 占い(Easy)
ユーザー caleicalei
提出日時 2020-01-30 16:15:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 458 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 91,948 KB
最終ジャッジ日時 2023-10-14 08:29:13
合計ジャッジ時間 10,639 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 251 ms
45,336 KB
testcase_01 AC 210 ms
45,300 KB
testcase_02 AC 206 ms
45,440 KB
testcase_03 AC 208 ms
45,392 KB
testcase_04 AC 211 ms
45,268 KB
testcase_05 AC 210 ms
45,344 KB
testcase_06 AC 212 ms
45,496 KB
testcase_07 AC 213 ms
45,424 KB
testcase_08 AC 221 ms
45,464 KB
testcase_09 AC 223 ms
45,524 KB
testcase_10 AC 211 ms
45,420 KB
testcase_11 AC 217 ms
45,284 KB
testcase_12 AC 288 ms
45,464 KB
testcase_13 AC 285 ms
45,496 KB
testcase_14 AC 214 ms
45,256 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 240 ms
45,268 KB
testcase_19 AC 230 ms
45,596 KB
testcase_20 AC 223 ms
45,548 KB
testcase_21 AC 226 ms
45,448 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 217 ms
91,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# yukicoder No.432 占い(Easy) 2020/01/30

from scipy.special import comb

t=int(input())
s=[list(map(int,list(input()))) for _ in range(t)]

for e in s:
    n=len(e)
    res=0
    if n==1:
        print(*e)
    elif n==2:
        print(e[0]+e[1])
    else:
        for k,f in enumerate(e,1):
            res+=comb(n-1,k-1,exact=True)*f
        ret=(sum(map(int,list(str(res)))))
        if ret%9:
            print(ret%9)
        else:
            print(9)
0