Zongwei_Qin
Zongwei_Qin
全部文章
分类
归档
标签
去牛客网
登录
/
注册
Zongwei_Qin的博客
全部文章
(共5篇)
题解 | #跳跃游戏(三)#
采用贪心策略,从a[0]开始,每次跳之前判断当前点能跳到的点中哪个点能跳得更远,然后跳到那个点。如果当前点能直接跳到a[n-1],则跳一步结束循环;如果当前点能跳到的每个点都不能比当前点跳得更远,GG,说明跳不到a[n-1]。n<=1e5,m<1e3,时间复杂度为O(mn),不会超时。 ...
2024-03-21
0
285
题解 | #跳跃游戏(一)#
#include <cstdio> #include <iostream> using namespace std; int main() { int n, a[200010]; bool dp[200010] = {false}; scanf(&q...
2024-03-21
0
254
题解 | #滑雪#
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int map[101][101], dp[101][101] = {0};//dp存储从每个点开始的...
2024-03-19
0
298
题解 | #环形数组的连续子数组最大和#
要求最大连续子数列,只可能有两种情况:一是不过环,二是要过环(当数组长度>2)。那么就将两种情况的最大值分别求出来,再进行比较取最大值。其中,第一种不过环的好求,就是普通数组的连续子数组最大值;对于第二种过环的,我们要知道:在一个数组中除去头尾后,取一个不过环的连续子数列,剩余部分便是一个过环...
2024-03-18
3
438
题解 | #快速乘#
常规的快速乘算法如下: #include <cstdio> using namespace std; int main() { long long q,a, b,p; scanf("%lld",&q); while (q--) ...
2024-03-16
3
255