結果
| 問題 | No.1407 Kindness |
| コンテスト | |
| ユーザー |
donuthole
|
| 提出日時 | 2021-02-27 14:11:52 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 138 ms / 2,000 ms |
| コード長 | 1,313 bytes |
| 記録 | |
| コンパイル時間 | 281 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 87,552 KB |
| 最終ジャッジ日時 | 2026-04-19 01:34:02 |
| 合計ジャッジ時間 | 6,418 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
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()
donuthole