結果

問題 No.1407 Kindness
ユーザー vwxyzvwxyz
提出日時 2023-02-02 14:28:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 914 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 11,912 KB
最終ジャッジ日時 2023-09-14 20:46:46
合計ジャッジ時間 4,839 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,384 KB
testcase_01 AC 33 ms
10,448 KB
testcase_02 AC 33 ms
10,508 KB
testcase_03 AC 34 ms
10,492 KB
testcase_04 AC 33 ms
10,392 KB
testcase_05 AC 33 ms
10,476 KB
testcase_06 AC 34 ms
10,444 KB
testcase_07 AC 33 ms
10,452 KB
testcase_08 AC 33 ms
10,464 KB
testcase_09 AC 34 ms
10,472 KB
testcase_10 AC 34 ms
10,340 KB
testcase_11 AC 33 ms
10,376 KB
testcase_12 AC 106 ms
11,840 KB
testcase_13 AC 51 ms
10,628 KB
testcase_14 AC 55 ms
10,692 KB
testcase_15 AC 105 ms
11,784 KB
testcase_16 AC 73 ms
11,116 KB
testcase_17 AC 62 ms
11,128 KB
testcase_18 AC 60 ms
10,932 KB
testcase_19 AC 92 ms
11,712 KB
testcase_20 AC 83 ms
11,280 KB
testcase_21 AC 37 ms
10,532 KB
testcase_22 AC 39 ms
10,604 KB
testcase_23 AC 80 ms
11,196 KB
testcase_24 AC 116 ms
11,912 KB
testcase_25 AC 61 ms
11,000 KB
testcase_26 AC 72 ms
11,276 KB
testcase_27 AC 39 ms
10,588 KB
testcase_28 AC 98 ms
11,872 KB
testcase_29 AC 36 ms
10,480 KB
testcase_30 AC 109 ms
11,864 KB
testcase_31 AC 52 ms
10,640 KB
testcase_32 AC 107 ms
11,672 KB
testcase_33 AC 61 ms
10,708 KB
testcase_34 AC 87 ms
11,372 KB
testcase_35 AC 55 ms
10,716 KB
testcase_36 AC 36 ms
10,424 KB
testcase_37 AC 116 ms
11,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines
write=sys.stdout.write

N=list(map(int,list(readline().rstrip())))
mod=10**9+7
ans=0
for n in range(1,N[0]):
    ans+=n
p=N[0]
for n in N[1:]:
    ans*=45
    ans+=45
    ans+=p*n*(n-1)//2
    ans%=mod
    p*=n
    p%=mod
ans+=p
ans%=mod
print(ans)
0