結果

問題 No.432 占い(Easy)
ユーザー calei
提出日時 2020-01-30 16:15:24
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 458 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 106,380 KB
最終ジャッジ日時 2024-09-16 03:36:44
合計ジャッジ時間 8,060 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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