結果

問題 No.1081 和の和
ユーザー GrayCoderGrayCoder
提出日時 2020-06-19 21:57:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 2,382 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 11,028 KB
実行使用メモリ 8,456 KB
最終ジャッジ日時 2023-09-16 14:06:31
合計ジャッジ時間 948 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,404 KB
testcase_01 AC 16 ms
8,336 KB
testcase_02 AC 16 ms
8,444 KB
testcase_03 AC 16 ms
8,240 KB
testcase_04 AC 17 ms
8,456 KB
testcase_05 AC 16 ms
8,380 KB
testcase_06 AC 15 ms
8,312 KB
testcase_07 AC 19 ms
8,264 KB
testcase_08 AC 19 ms
8,380 KB
testcase_09 AC 19 ms
8,448 KB
testcase_10 AC 19 ms
8,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

'''
from math import gcd
from itertools import accumulate, combinations, permutations, product
from bisect import bisect, bisect_left
from collections import Counter, defaultdict, deque
from heapq import heappush, heappop
from functools import reduce
from operator import add, mul, sub, truediv, floordiv, mod

from decimal import *
getcontext().prec = 500

import string
ascii = string.ascii_lowercase
'''
from sys import stdin


class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    A = list(map(ModInt, map(int, input().split())))

    for n in range(N - 1, 0, -1):
        for i in range(n):
            A[i] = A[i] + A[i+1]
    print(A[0])


MOD = 1000000007
main()
0