結果
問題 | No.797 Noelちゃんとピラミッド |
ユーザー | McGregorsh |
提出日時 | 2023-07-06 22:19:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 408 ms / 2,000 ms |
コード長 | 1,632 bytes |
コンパイル時間 | 380 ms |
コンパイル使用メモリ | 87,120 KB |
実行使用メモリ | 112,664 KB |
最終ジャッジ日時 | 2023-09-27 23:20:33 |
合計ジャッジ時間 | 25,251 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 232 ms
97,484 KB |
testcase_01 | AC | 217 ms
97,520 KB |
testcase_02 | AC | 209 ms
97,284 KB |
testcase_03 | AC | 408 ms
112,396 KB |
testcase_04 | AC | 408 ms
112,620 KB |
testcase_05 | AC | 373 ms
112,620 KB |
testcase_06 | AC | 372 ms
112,592 KB |
testcase_07 | AC | 366 ms
112,404 KB |
testcase_08 | AC | 371 ms
112,484 KB |
testcase_09 | AC | 369 ms
112,532 KB |
testcase_10 | AC | 377 ms
112,536 KB |
testcase_11 | AC | 370 ms
112,144 KB |
testcase_12 | AC | 376 ms
112,620 KB |
testcase_13 | AC | 374 ms
112,460 KB |
testcase_14 | AC | 374 ms
112,492 KB |
testcase_15 | AC | 372 ms
112,460 KB |
testcase_16 | AC | 375 ms
112,228 KB |
testcase_17 | AC | 378 ms
112,236 KB |
testcase_18 | AC | 403 ms
112,624 KB |
testcase_19 | AC | 380 ms
112,624 KB |
testcase_20 | AC | 373 ms
112,404 KB |
testcase_21 | AC | 369 ms
112,616 KB |
testcase_22 | AC | 373 ms
112,636 KB |
testcase_23 | AC | 328 ms
108,148 KB |
testcase_24 | AC | 269 ms
99,784 KB |
testcase_25 | AC | 310 ms
106,832 KB |
testcase_26 | AC | 320 ms
105,420 KB |
testcase_27 | AC | 376 ms
112,664 KB |
testcase_28 | AC | 358 ms
111,156 KB |
testcase_29 | AC | 246 ms
98,940 KB |
testcase_30 | AC | 254 ms
99,920 KB |
testcase_31 | AC | 328 ms
108,176 KB |
testcase_32 | AC | 271 ms
101,956 KB |
testcase_33 | AC | 317 ms
106,800 KB |
testcase_34 | AC | 288 ms
104,008 KB |
testcase_35 | AC | 382 ms
112,404 KB |
testcase_36 | AC | 240 ms
98,256 KB |
testcase_37 | AC | 354 ms
111,048 KB |
testcase_38 | AC | 363 ms
112,336 KB |
testcase_39 | AC | 308 ms
106,468 KB |
testcase_40 | AC | 239 ms
98,156 KB |
testcase_41 | AC | 247 ms
99,116 KB |
testcase_42 | AC | 303 ms
105,464 KB |
testcase_43 | AC | 208 ms
97,532 KB |
testcase_44 | AC | 208 ms
97,400 KB |
testcase_45 | AC | 212 ms
97,392 KB |
testcase_46 | AC | 215 ms
97,660 KB |
testcase_47 | AC | 217 ms
97,528 KB |
testcase_48 | AC | 209 ms
97,612 KB |
testcase_49 | AC | 213 ms
97,396 KB |
testcase_50 | AC | 210 ms
97,560 KB |
testcase_51 | AC | 211 ms
97,484 KB |
testcase_52 | AC | 212 ms
97,452 KB |
testcase_53 | AC | 213 ms
97,604 KB |
testcase_54 | AC | 208 ms
97,400 KB |
testcase_55 | AC | 208 ms
97,556 KB |
testcase_56 | AC | 210 ms
97,408 KB |
testcase_57 | AC | 207 ms
97,464 KB |
testcase_58 | AC | 209 ms
97,532 KB |
testcase_59 | AC | 209 ms
97,552 KB |
testcase_60 | AC | 213 ms
97,336 KB |
testcase_61 | AC | 214 ms
97,536 KB |
testcase_62 | AC | 217 ms
97,316 KB |
ソースコード
import sys from sys import stdin from fractions import Fraction import math from math import ceil, floor, sqrt, pi, factorial, gcd from copy import deepcopy from collections import Counter, deque, defaultdict from heapq import heapify, heappop, heappush from itertools import accumulate, product, combinations, combinations_with_replacement, permutations from bisect import bisect, bisect_left, bisect_right from functools import reduce, lru_cache from decimal import Decimal, getcontext, ROUND_HALF_UP def i_input(): return int(stdin.readline()) def i_map(): return map(int, stdin.readline().split()) def i_list(): return list(i_map()) def s_input(): return stdin.readline()[:-1] def s_map(): return s_input().split() def s_list(): return list(s_map()) def lcm(a, b): return a * b // gcd(a, b) def get_distance(x1, y1, x2, y2): d = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) return d def rotate(table): n_fild = [] for x in zip(*table[::-1]): n_fild.append(x) return n_fild sys.setrecursionlimit(10 ** 7) INF = float('inf') MOD = 10 ** 9 + 7 MOD2 = 998244353 alpa = 'abcdefghijklmnopqrstuvwxyz' ALPA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def main(): fact = [1] for i in range(1, 110000): fact.append(fact[-1] * i % MOD) def rev(x): return pow(x, MOD-2, MOD) def c(i, k): if(i < k):return 0 return fact[i] * rev(fact[k]) * rev(fact[i-k]) % MOD N = int(input()) A = i_list() ans = 0 for i in range(N): score = A[i] * c(N-1, i) % MOD ans += score ans %= MOD print(ans) if __name__ == '__main__': main()