結果

問題 No.432 占い(Easy)
コンテスト
ユーザー calei
提出日時 2020-01-30 16:15:24
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 458 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 392 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 107,464 KB
最終ジャッジ日時 2026-04-05 07:55:18
合計ジャッジ時間 39,638 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 TLE * 1
other AC * 16 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# 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