上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 15 下一页
摘要: E - 树状数组 1 原题链接 题目描述 如题,已知一个数列,你需要进行下面两种操作: 将某一个数加上 $x$ 求出某区间每一个数的和 输入格式 第一行包含两个正整数 $n,m$,分别表示该数列数字的个数和操作的总个数。 第二行包含 $n$ 个用空格分隔的整数,其中第 $i$ 个数字表示数列第 $i 阅读全文
posted @ 2023-02-19 11:22 Keith- 阅读(68) 评论(0) 推荐(0)
摘要: B - Learning Languages 原题链接 思路 由于可以传译,所以可以将共同语言(包括传译)者视为一个集合(合并),最后查询总共集合数-1就是答案 注意 特判:有可能有公司所有人一种语言都不会,而答案不应为-1,所以需要特判 代码 点击查看代码 #include<iostream> # 阅读全文
posted @ 2023-02-19 00:41 Keith- 阅读(30) 评论(0) 推荐(0)
摘要: A - 并查集 思路 模板 注意 01串的处理 代码 点击查看代码 #include<iostream> using namespace std; #define X first #define Y second typedef pair<int,int> pii; typedef long lon 阅读全文
posted @ 2023-02-19 00:35 Keith- 阅读(33) 评论(0) 推荐(0)
摘要: B - 滑雪 原题链接 思路 $定义f(i,j)为从坐标(i,j)出发的最大值$ $状态转移方程f(i,j) = max(f(i+dx[k],j+dy[k]))$ $答案为max(f(1,1),f(1,2),...,f(n,m))$ 注意 $维护dp顺序使得坡度更低的坐标先被计算pair<int,p 阅读全文
posted @ 2023-02-19 00:29 Keith- 阅读(22) 评论(0) 推荐(0)
摘要: 摆花 原题链接 思路 $\text { 有 } n \text { 个数 }\left(c_{1}, c_{2}, \ldots, c_{n}\right) , 0 \leqslant c_{i} \leqslant a_{i} \text {, 求有多少种方案数使 } \sum_{i=1}^{n} 阅读全文
posted @ 2023-02-19 00:19 Keith- 阅读(22) 评论(0) 推荐(0)
摘要: G 阿宁的整数配对 原题连接 代码 点击查看代码 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<vector> #include<queue> us 阅读全文
posted @ 2023-02-04 11:45 Keith- 阅读(24) 评论(0) 推荐(0)
摘要: C 阿宁的大背包 原题链接 代码 点击查看代码 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<vector> #include<queue> usi 阅读全文
posted @ 2023-02-04 11:35 Keith- 阅读(40) 评论(0) 推荐(0)
摘要: H 阿宁讨伐虚空 原题链接 思路 $x≤L$时,脆皮都死完了,虚空蛇肯定不会被打到。 $x>R$时,脆皮怎么都死不玩,虚空蛇肯定会被打到。 $L≤x<R$时,如果$y \in [L, x)$,那么脆皮没有死完,区间$[L,x)$长度是$x−L$,因此概率是$\frac {x-L}{R-L+1} $ 阅读全文
posted @ 2023-02-04 11:31 Keith- 阅读(29) 评论(0) 推荐(0)
摘要: A 阿宁的签到题 原题链接 代码 点击查看代码 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<vector> #include<queue> usi 阅读全文
posted @ 2023-02-04 11:26 Keith- 阅读(20) 评论(0) 推荐(0)
摘要: C 清楚姐姐学01背包(Easy Version) 原题链接 思路 求出强制不选择某一物品的最大价值$v1$,以及强制选择某一物品的最大价值$v2$ 不选择比选择大说明一定不选 -> 输出$v1-v2+1$ 不选择与选择相等说明可选可不选 -> $1(v1-v2+1)$ 不选择比选择小说明一定选 - 阅读全文
posted @ 2023-02-04 11:23 Keith- 阅读(37) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 15 下一页