結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 217 ms
45,416 KB
testcase_01 AC 223 ms
45,356 KB
testcase_02 AC 214 ms
45,296 KB
testcase_03 AC 215 ms
45,396 KB
testcase_04 AC 221 ms
45,320 KB
testcase_05 AC 215 ms
45,380 KB
testcase_06 AC 214 ms
45,420 KB
testcase_07 AC 215 ms
45,348 KB
testcase_08 AC 217 ms
45,324 KB
testcase_09 AC 220 ms
45,568 KB
testcase_10 AC 216 ms
45,320 KB
testcase_11 AC 219 ms
45,388 KB
testcase_12 AC 287 ms
45,456 KB
testcase_13 AC 288 ms
45,268 KB
testcase_14 AC 222 ms
45,476 KB
testcase_15 AC 215 ms
45,360 KB
testcase_16 AC 218 ms
45,368 KB
testcase_17 AC 288 ms
45,336 KB
testcase_18 AC 240 ms
45,364 KB
testcase_19 AC 231 ms
45,364 KB
testcase_20 AC 219 ms
45,316 KB
testcase_21 AC 220 ms
45,396 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 227 ms
45,724 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
        if res==0:
            print(res)
            continue
        ret=(sum(map(int,list(str(res)))))
        if ret%9:
            print(ret%9)
        else:
            print(9)
0