上一页 1 2 3 4 5 6 7 8 ··· 20 下一页
摘要: 给定两个长度分别为N和M的字符串A和B,求既是A的子序列又是B的子序列的字符串长度最长是多少。 输入格式 第一行包含两个整数N和M。 第二行包含一个长度为N的字符串,表示字符串A。 第三行包含一个长度为M的字符串,表示字符串B。 字符串均由小写字母构成。 输出格式 输出一个整数,表示最大长度。 数据 阅读全文
posted @ 2020-05-15 10:35 Hazelxcf 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 给定一个长度为N的数列,求数值严格单调递增的子序列的长度最长是多少。 输入格式 第一行包含整数N。 第二行包含N个整数,表示完整序列。 输出格式 输出一个整数,表示最大长度。 数据范围 1≤N≤100000−109≤数列中的数≤109 输入样例: 7 3 1 2 1 8 5 6 输出样例: 4 严格 阅读全文
posted @ 2020-05-15 10:25 Hazelxcf 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 给定一个浮点数n,求它的三次方根。 输入格式 共一行,包含一个浮点数n。 输出格式 共一行,包含一个浮点数,表示问题的解。 注意,结果保留6位小数。 数据范围 −10000≤n≤10000 输入样例: 1000.00 输出样例: 10.000000 #include <bits/stdc++.h> 阅读全文
posted @ 2020-05-11 11:47 Hazelxcf 阅读(363) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 3e3 + 10; int n,a[maxn]; int solve(int l,int r){ int minn = 1e9 + 阅读全文
posted @ 2020-05-02 19:43 Hazelxcf 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 注意:题目说了,所有道路单行 所以了两次迪杰斯特拉 #include <bits/stdc++.h> using namespace std; const int nn = 1e3 + 5; const int mm = 1e5 + 5; int d[nn],head[nn],ver[mm],edg 阅读全文
posted @ 2020-05-02 12:14 Hazelxcf 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define int long long 4 const int maxn = 1e4 + 10; 5 int n,k,b[maxn],dp[maxn]; 6 struct node{ 7 in 阅读全文
posted @ 2020-04-30 10:18 Hazelxcf 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 和LIS反着 本题直接做就行, 注意计算方案数,不是说找到最大的方案,然后再找比他小的就可以了,还要注意去重,所以再建立一个数组c;记录方案数目 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define int long long 4 c 阅读全文
posted @ 2020-04-30 09:25 Hazelxcf 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 参考的大佬的博客 求什么设什么,dp[l][r]为l到r堆范围的石子数量的最值 相邻合并为一堆,所以枚举最小值是2 这两堆又是由另外的两堆石子合并,可认为是由dp[l][k]和dp[k + 1][r] 根据k的值将对应范围分为了两部分,然后根据公式会分为更多部分 #include <bits/std 阅读全文
posted @ 2020-04-28 21:19 Hazelxcf 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 链接 最少的反转次数使的点数只差最小 注意绝对值 dp[i][j]表示前i个物品达到j,可以反转,也可以不转 int g = a[i] - b[i]; 状态转移方程 dp[i][j] = min(dp[i - 1],[j - g + 5000],dp[j + g + 5000]+ 1); 为什么要加 阅读全文
posted @ 2020-04-26 16:38 Hazelxcf 阅读(171) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-04-26 07:50 Hazelxcf 阅读(0) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 20 下一页