結果
問題 | No.797 Noelちゃんとピラミッド |
ユーザー | McGregorsh |
提出日時 | 2023-07-06 22:19:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 352 ms / 2,000 ms |
コード長 | 1,632 bytes |
コンパイル時間 | 180 ms |
コンパイル使用メモリ | 82,192 KB |
実行使用メモリ | 110,464 KB |
最終ジャッジ日時 | 2024-07-20 17:44:00 |
合計ジャッジ時間 | 19,015 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 155 ms
94,848 KB |
testcase_01 | AC | 146 ms
94,976 KB |
testcase_02 | AC | 153 ms
94,964 KB |
testcase_03 | AC | 349 ms
109,996 KB |
testcase_04 | AC | 344 ms
109,824 KB |
testcase_05 | AC | 333 ms
110,268 KB |
testcase_06 | AC | 348 ms
110,208 KB |
testcase_07 | AC | 336 ms
110,464 KB |
testcase_08 | AC | 332 ms
109,952 KB |
testcase_09 | AC | 335 ms
109,996 KB |
testcase_10 | AC | 334 ms
109,924 KB |
testcase_11 | AC | 336 ms
109,952 KB |
testcase_12 | AC | 340 ms
109,952 KB |
testcase_13 | AC | 333 ms
109,952 KB |
testcase_14 | AC | 334 ms
110,092 KB |
testcase_15 | AC | 334 ms
110,208 KB |
testcase_16 | AC | 338 ms
109,972 KB |
testcase_17 | AC | 334 ms
110,072 KB |
testcase_18 | AC | 336 ms
109,952 KB |
testcase_19 | AC | 333 ms
110,272 KB |
testcase_20 | AC | 337 ms
110,004 KB |
testcase_21 | AC | 338 ms
110,264 KB |
testcase_22 | AC | 332 ms
110,336 KB |
testcase_23 | AC | 286 ms
105,216 KB |
testcase_24 | AC | 200 ms
96,896 KB |
testcase_25 | AC | 269 ms
104,264 KB |
testcase_26 | AC | 260 ms
102,252 KB |
testcase_27 | AC | 331 ms
110,208 KB |
testcase_28 | AC | 316 ms
108,400 KB |
testcase_29 | AC | 186 ms
96,000 KB |
testcase_30 | AC | 201 ms
97,024 KB |
testcase_31 | AC | 304 ms
105,064 KB |
testcase_32 | AC | 242 ms
98,048 KB |
testcase_33 | AC | 299 ms
104,016 KB |
testcase_34 | AC | 263 ms
100,224 KB |
testcase_35 | AC | 352 ms
110,084 KB |
testcase_36 | AC | 186 ms
95,956 KB |
testcase_37 | AC | 320 ms
108,548 KB |
testcase_38 | AC | 336 ms
109,892 KB |
testcase_39 | AC | 260 ms
103,404 KB |
testcase_40 | AC | 179 ms
95,360 KB |
testcase_41 | AC | 201 ms
96,000 KB |
testcase_42 | AC | 262 ms
102,272 KB |
testcase_43 | AC | 160 ms
95,028 KB |
testcase_44 | AC | 156 ms
94,848 KB |
testcase_45 | AC | 156 ms
95,104 KB |
testcase_46 | AC | 149 ms
95,232 KB |
testcase_47 | AC | 149 ms
95,232 KB |
testcase_48 | AC | 151 ms
95,108 KB |
testcase_49 | AC | 161 ms
95,184 KB |
testcase_50 | AC | 156 ms
94,936 KB |
testcase_51 | AC | 157 ms
95,148 KB |
testcase_52 | AC | 154 ms
94,820 KB |
testcase_53 | AC | 149 ms
95,104 KB |
testcase_54 | AC | 150 ms
95,000 KB |
testcase_55 | AC | 149 ms
94,848 KB |
testcase_56 | AC | 160 ms
94,888 KB |
testcase_57 | AC | 157 ms
95,104 KB |
testcase_58 | AC | 163 ms
95,104 KB |
testcase_59 | AC | 158 ms
94,720 KB |
testcase_60 | AC | 157 ms
95,148 KB |
testcase_61 | AC | 159 ms
94,968 KB |
testcase_62 | AC | 150 ms
94,936 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()