ACM-ICPC 2018 徐州赛区网络预赛 H. Ryuji doesn’t want to study
题目
给一个 1e5 序列,有 1e5 次操作,每次操作有两种,1 单点修改,2 查询区间 (l, r) 值,
每个区间 【l, r】值计算过程(L 为区间长度):
分析
每次区间查询可以看成两个前缀和相减。
一个是普通前缀和,另一个是题目中的 1 ~ n 前缀和。
求区间 【l, r】就是图中梯形减去平行四边形,也就是减去一定倍数的普通区间和。
用树状数组维护前缀和。
给一个 1e5 序列,有 1e5 次操作,每次操作有两种,1 单点修改,2 查询区间 (l, r) 值,
每个区间 【l, r】值计算过程(L 为区间长度):
每次区间查询可以看成两个前缀和相减。
一个是普通前缀和,另一个是题目中的 1 ~ n 前缀和。
求区间 【l, r】就是图中梯形减去平行四边形,也就是减去一定倍数的普通区间和。
用树状数组维护前缀和。
ACM-ICPC 2018 徐州赛区网络预赛过题 大于200
Trace问题分析题意:nnn波矩形海浪,每次都会在沙滩上留下痕迹,求最后的痕迹长度。 题解
ACM-ICPC 2018 焦作赛区网络预赛过题 大于200 A
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M