摘要: 题目链接 思路 暴力 \(O(n^2).\) 期望得分: $9.$ 考虑到此题有两种做法: $1.$ \(O(n^2)\) 复杂度,每次询问的时候累加: ans = 0; for (int q = y;q <= n;q += x) { ans += a[q]; } printf ("%d\n",an 阅读全文
posted @ 2020-11-01 18:18 tuscjaf 阅读(62) 评论(0) 推荐(0) 编辑
摘要: 题目链接 思路1 可以发现,模的值呈周期性,一个周期 \(a \times b\) 个值。 如果 \(a \times b \le r -l.\) 那么直接输出周期里的最大值即可。 否则的话,就要查找区间 \(l \mod (a \times b) ~-~ r \mod (a \times b).\ 阅读全文
posted @ 2020-11-01 16:49 tuscjaf 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 题目链接 思路 构造,不会。 直接暴搜。(考场上不敢写于是骗了点分) 据说还是最简单的题 \(XD\)。 代码 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int MAXN 阅读全文
posted @ 2020-11-01 15:43 tuscjaf 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 题目链接 思路 按照斜率每次清除整条路上的骷髅(暴力算法),存图选用 \(vector <string>\),考场上直接开超大的 \(char\) \(MLE\) 了。 代码 #include <cstdio> #include <cstring> #include <iostream> #incl 阅读全文
posted @ 2020-11-01 15:25 tuscjaf 阅读(73) 评论(0) 推荐(0) 编辑
摘要: @(稀疏表 ST表) 写在前面 有错误请指出 正文 内容 ST表 是一个维护区间 最大值 或 最小值 的数据结构 ST表 用 \(O(n \log n)\) 的时间预处理,\(O(1)\) 的时间查询 设 \(f[i][j]\) 表示为 下标 \(i\) 起,$2^j$ 个数中的最大值,用倍增实现 阅读全文
posted @ 2020-11-01 12:56 tuscjaf 阅读(119) 评论(0) 推荐(0) 编辑