Frog

B - Frog 2

因为k很小,所以无需优化dp #include<bits/stdc++.h> using namespace std; void solve(){ int n,k; cin>>n>>k; vector<int>a(n+1); vector<int>dp(n+1,1e18); dp[1]=0; for ......
Frog

A - Frog 1

很好想的线性p #include<bits/stdc++.h> using namespace std; void solve(){ int n; cin>>n; vector<int>a(n+1); vector<int>dp(n+1,1e18); dp[1]=0; for(int i=1;i<= ......
Frog

题解 Frog 3

题目描述 将一个序列分成若干段,每一段的价值为 \((h_i-h_j)^2+C\),求价值和的最小值。 具体思路 设 \(f_i\) 表示前 \(i\) 个数分成若干段的价值和的最小值,并且 \(j+1 \sim i\) 被分成了一段。 那么 \(f_i\) 的状态应该由 \(f_j\) 转移过来。 ......
题解 Frog

题解 AT_dp_z Frog 3

分析 首先可以列出最基础的 DP 式子。设 \(dp_i\) 表示跳到 \(i\) 的最小花费,有: \[dp_i=\min\limits_{1\leq j < i }\{dp_j+(h_i-h_j)^2\}+C\]\[dp_1=0 \]直接算的话时间复杂度 \(O(n^2)\)。 然后化简一下式子 ......
题解 AT_dp_z Frog AT dp

题解 Gym 103960K【Kalel, the Jumping Frog】

## problem 一只青蛙,他会跳,现在要从 $1$ 跳到 $n$。跳一次有 $m$ 种跳法,假设现在在 $x$,那么第 $i$ 次可以从 $x$ 跳到 $x+d_i$,同时消耗 $p_j$ 的能量。问你有多少种跳的方案使得消耗能量不超过 $k$。$n\leq 10^9,m\leq 10^5,1 ......
题解 103960K Jumping 103960 Kalel

Frog 3 题解

[Frog 3](https://www.luogu.com.cn/problem/AT_dp_z) ### 题目大意 ~~题意都这么明确了还要这个干什么。~~ 存在 $n$ 个点,每个点有一个属性 $h_i$,$h_i$ 单增,从点 $i$ 移动到点 $j(j>i)$ 的代价是 $(h_i-h_j ......
题解 Frog

每日一题 力扣 1377 https://leetcode.cn/problems/frog-position-after-t-seconds/

力扣 1377 https://leetcode.cn/problems/frog-position-after-t-seconds/ 这道题目用dp去做,构建邻接矩阵,做的时候需要注意题目条件,如果青蛙跳不动了,这个概率就保持不变了 一般跳青蛙,很容易想到dp 核心代码如下 public doub ......

[ABC128F] Frog Jump

2023-01-14 题目传送门 翻译 难度&重要性(1~10):5 题目来源 AtCoder 题目算法 数学,模拟 解题思路 把(A-B)看为一步。应为最后必须落在N-1,所以可以将其分为两个序列: $(A+B),2\times(A+B),3\times(A+B),\cdots N-1-2\tim ......
128F Frog Jump ABC 128
共8篇  :1/1页 首页上一页1下一页尾页