HBC17685Prefix Sum题解

原来我爱你 算法基础篇 41 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。
Niuniu has learned prefix sum and he found an interesting about prefix sum. Let's consider (k+1) arrays a[i] (0

Niuniu has learned prefix sum and he found an interesting about prefix sum. Let's consider (k+1) arrays a[i] (0 <= i <= k) The index of a[i] starts from 1.  a[i] is always the prefix sum of a[i-1].  "always" means a[i] will change when a[i-1] changes. "prefix sum" means a[i][1] = a[i-1][1] and a[i][j] = a[i][j-1] + a[i-1][j] (j >= 2) Initially, all elements in a[0] are 0. There are two kinds of operations, which are modify and query. For a modify operation, two integers x, y are given, and it means a[0][x] += y. For a query operation, one integer x is given, and it means querying a[k][x]. As the result might be very large, you should output the result mod 1000000007.

HBC17685Prefix Sum题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC17685Prefix Sum题解