結果

問題 No.1102 Remnants
ユーザー buey_tbuey_t
提出日時 2023-03-21 18:28:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 369 ms / 2,000 ms
コード長 1,334 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,636 KB
実行使用メモリ 124,872 KB
最終ジャッジ日時 2023-10-18 18:30:45
合計ジャッジ時間 7,637 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
84,432 KB
testcase_01 AC 139 ms
84,440 KB
testcase_02 AC 134 ms
84,440 KB
testcase_03 AC 133 ms
84,436 KB
testcase_04 AC 133 ms
84,432 KB
testcase_05 AC 292 ms
115,324 KB
testcase_06 AC 172 ms
91,208 KB
testcase_07 AC 369 ms
124,872 KB
testcase_08 AC 151 ms
89,116 KB
testcase_09 AC 156 ms
89,112 KB
testcase_10 AC 149 ms
89,120 KB
testcase_11 AC 156 ms
89,148 KB
testcase_12 AC 160 ms
89,132 KB
testcase_13 AC 156 ms
89,108 KB
testcase_14 AC 228 ms
101,324 KB
testcase_15 AC 206 ms
98,056 KB
testcase_16 AC 324 ms
120,648 KB
testcase_17 AC 341 ms
118,860 KB
testcase_18 AC 341 ms
120,444 KB
testcase_19 AC 215 ms
98,532 KB
testcase_20 AC 166 ms
89,428 KB
testcase_21 AC 263 ms
108,240 KB
testcase_22 AC 313 ms
116,688 KB
testcase_23 AC 274 ms
108,504 KB
testcase_24 AC 237 ms
102,168 KB
testcase_25 AC 346 ms
120,648 KB
testcase_26 AC 160 ms
89,288 KB
testcase_27 AC 201 ms
95,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
    from heapq import heapify, heappop, heappush
    from bisect import bisect_left, bisect_right
    from copy import deepcopy
    import copy
    import random
    from collections import deque,Counter,defaultdict
    from itertools import permutations,combinations
    from decimal import Decimal,ROUND_HALF_UP
    #tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
    from functools import lru_cache, reduce
    #@lru_cache(maxsize=None)
    from operator import add,sub,mul,xor,and_,or_,itemgetter
    INF = 10**18
    mod1 = 10**9+7
    mod2 = 998244353
    
    #DecimalならPython
    
    
    '''
    
    
    
    '''
    
    N,K = map(int, input().split())
    A = list(map(int, input().split()))
    
    rCk = [-1]*(N+1)
    rCk[0] = 1
    for i in range(1,N+1):
        r = K+i
        rCk[i] = rCk[i-1]*r*pow(r-K,mod1-2,mod1)
        rCk[i] %= mod1
    
    ans = 0
    for i in range(1,N+1):
        ans += rCk[i-1]*rCk[N-i]*A[i-1]
        ans %= mod1
    
    print(ans)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0