結果

問題 No.1407 Kindness
ユーザー ygd.ygd.
提出日時 2021-02-26 21:50:16
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 454 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 82,396 KB
実行使用メモリ 67,152 KB
最終ジャッジ日時 2024-04-10 12:30:09
合計ジャッジ時間 3,267 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,188 KB
testcase_01 AC 38 ms
52,200 KB
testcase_02 AC 37 ms
52,128 KB
testcase_03 AC 37 ms
52,476 KB
testcase_04 AC 37 ms
52,404 KB
testcase_05 AC 37 ms
52,192 KB
testcase_06 AC 37 ms
52,820 KB
testcase_07 AC 37 ms
53,104 KB
testcase_08 AC 37 ms
52,556 KB
testcase_09 AC 36 ms
52,684 KB
testcase_10 AC 37 ms
52,936 KB
testcase_11 AC 37 ms
53,108 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 47 ms
62,580 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 AC 49 ms
62,568 KB
testcase_37 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
L = list(str(N))
L = [int(x) for x in L]
#print(L)
M = len(str(N))
MOD = pow(10,9)+7

A = 45
ans = 0
for i in range(1,M):
    ans += pow(A,i,MOD)
exact = 1
for i in range(M):
    keta = M - i
    shita = (L[i]-1)*L[i]//2
    #print(shita,keta)
    if i != M-1:
        ans += exact*shita* pow(A,keta-1,MOD)
        exact = exact*L[i]%MOD
    else:
        exact = exact*(1+L[i])*L[i]//2%MOD
#print(ans,exact)
ans += exact

print(ans%MOD)
0