結果
| 問題 |
No.1407 Kindness
|
| コンテスト | |
| ユーザー |
donuthole
|
| 提出日時 | 2021-02-27 14:11:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 159 ms / 2,000 ms |
| コード長 | 1,313 bytes |
| コンパイル時間 | 307 ms |
| コンパイル使用メモリ | 82,336 KB |
| 実行使用メモリ | 89,772 KB |
| 最終ジャッジ日時 | 2024-10-02 17:27:36 |
| 合計ジャッジ時間 | 7,068 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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