結果

問題 No.1407 Kindness
ユーザー donutholedonuthole
提出日時 2021-02-27 14:11:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 1,313 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 89,780 KB
最終ジャッジ日時 2024-04-10 15:37:02
合計ジャッジ時間 6,932 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
86,656 KB
testcase_01 AC 139 ms
86,480 KB
testcase_02 AC 136 ms
87,040 KB
testcase_03 AC 134 ms
86,728 KB
testcase_04 AC 129 ms
86,656 KB
testcase_05 AC 130 ms
86,592 KB
testcase_06 AC 129 ms
86,528 KB
testcase_07 AC 132 ms
86,400 KB
testcase_08 AC 130 ms
86,736 KB
testcase_09 AC 129 ms
86,732 KB
testcase_10 AC 126 ms
86,732 KB
testcase_11 AC 125 ms
86,680 KB
testcase_12 AC 153 ms
89,304 KB
testcase_13 AC 138 ms
89,728 KB
testcase_14 AC 144 ms
89,600 KB
testcase_15 AC 154 ms
89,780 KB
testcase_16 AC 145 ms
89,508 KB
testcase_17 AC 146 ms
89,492 KB
testcase_18 AC 139 ms
89,448 KB
testcase_19 AC 146 ms
89,548 KB
testcase_20 AC 145 ms
89,600 KB
testcase_21 AC 132 ms
89,516 KB
testcase_22 AC 141 ms
89,472 KB
testcase_23 AC 150 ms
89,600 KB
testcase_24 AC 154 ms
89,356 KB
testcase_25 AC 140 ms
89,428 KB
testcase_26 AC 145 ms
89,472 KB
testcase_27 AC 133 ms
89,600 KB
testcase_28 AC 155 ms
89,728 KB
testcase_29 AC 139 ms
89,600 KB
testcase_30 AC 161 ms
89,608 KB
testcase_31 AC 146 ms
89,600 KB
testcase_32 AC 149 ms
89,728 KB
testcase_33 AC 140 ms
89,160 KB
testcase_34 AC 143 ms
89,532 KB
testcase_35 AC 139 ms
89,384 KB
testcase_36 AC 138 ms
89,472 KB
testcase_37 AC 148 ms
89,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
import collections
import bisect
import itertools
import decimal
import heapq


# sys.setrecursionlimit(10**6+1)
INF = 1 << 62
MOD = 10 ** 9 + 7
# MOD = 998244353


def ni(): return int(sys.stdin.buffer.readline())
def ns(): return map(int, sys.stdin.buffer.readline().split())
def na(): return list(map(int, sys.stdin.buffer.readline().split()))
def na1(): return list(map(lambda x: int(x)-1, sys.stdin.buffer.readline().split()))
def nall(): return list(map(int, sys.stdin.buffer.read().split()))
def flush(): return sys.stdout.flush()


def nic(): return int(sys.stdin.readline())
def nsc(): return map(int, sys.stdin.readline().split())
def nac(): return list(map(int, sys.stdin.readline().split()))
def na1c(): return list(map(lambda x: int(x)-1, sys.stdin.readline().split()))


# ===CODE==
def main():
    s = input()
    l = len(s)
    dpT,  dpF = 0, 1

    for i in range(l):
        keta = int(s[i])
        ndpT, ndpF = 0, 0
        for j in range(10):
            ndpT += dpT*j
            if j < keta:
                ndpT += dpF*j
            elif j == keta:
                ndpF += dpF*j
            if i != 0:
                ndpT += j

        ndpT %= MOD
        ndpF %= MOD
        dpT, dpF = ndpT, ndpF
    print((dpT+dpF) % MOD)


if __name__ == '__main__':
    main()
0