
前缀和
nobleman__
加油王先生
展开
-
codeforces920 C. Swap Adjacent Elements【连通块 + 前缀和】
C. Swap Adjacent Elements time limit per test1 second memory limit per test256 megabytes You have an array a consisting of n integers. Each integer from 1 to n appears exactly once in this array.原创 2018-02-03 10:17:41 · 413 阅读 · 0 评论 -
hihoCoder #1502 : 最大子矩阵【前缀和 + Two Pointers】
1502 : 最大子矩阵 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一个NxM的矩阵A和一个整数K,小Hi希望你能求出其中最大(元素数目最多)的子矩阵,并且该子矩阵中所有元素的和不超过K。 输入 第一行包含三个整数N、M和K。 以下N行每行包含M个整数,表示A。 对于40%的数据,1 <= N, M <= 10 对于100...原创 2018-03-07 17:25:29 · 707 阅读 · 0 评论 -
牛客练习赛13 B 幸运数字Ⅱ【前缀和 + 位运算 + 二分】
题目描述 定义一个数字为幸运数字当且仅当它的所有数位都是4或者7。 比如说,47、744、4都是幸运数字而5、17、467都不是。 定义next(x)为大于等于x的第一个幸运数字。给定l,r,请求出next(l) + next(l + 1) + … + next(r - 1) + next(r)。 输入描述: 两个整数l和r (1 <= l <= r <= 1000,...原创 2018-03-16 20:58:16 · 756 阅读 · 0 评论 -
codeforces 383 A. Milking cows【贪心 + 前缀和】
A. Milking cows time limit per test1 second memory limit per test256 megabytes Iahub helps his grandfather at the farm. Today he must milk the cows. There are n cows sitting in a row, numbered from...原创 2018-03-19 22:05:35 · 563 阅读 · 0 评论