题解列表

筛选

3050: 最长上升子序列(线性dp)

摘要:题目描述:给定一个长度为N的数列,求数值严格单调递增的子序列的长度最长是多少。 解题思路:线性dp 1.状态表示: 所有以i结尾的严格单调上升的子序列的长度的集合(MAX) 2.状态计算: 只需……

时间复杂度O(n)的算法

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;#define maxn 100010//−100000≤ Ai ≤100000ty……

数的划分(dp)

摘要:解题思路:动态规划 状态方程:dp[i][j]:表示数字 i,被分解为 j份 的方案总数 因为分解的每一份不能为空,则先将每一份都分配 1,剩余数值为 i-j ,再将 i-j 分为 1 份,2份,……

时间复杂度的O(n)算法

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;#define maxn 100010#define maxk 100010//0 ……

C语言 统计字符&

摘要:解题思路:注意事项:参考代码:#include <stdio.h>#include <string.h>#define LONG 100int main(){         char c[LONG]……

一种超简单标准的枚举方法

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){    enum play{lose=-1,equality,win} result;    int a,b;  ……

一种超简单的方法

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){    int m,n;    int t;    int i,j;    int x,y;    scanf("……

一种超简单的方法

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){    int m,n,w=1;    int t;    int i,j;    int x,y;    sca……