随笔分类 -  算法

摘要:1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 int LIS(int nums[],int n) 5 { 6 int dp[n]; 7 int Max=dp[0]=1; 8 for(int i=1;i<n;++ 阅读全文
posted @ 2021-05-13 23:17 丁帅帅dss 阅读(65) 评论(0) 推荐(0)
摘要:1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 int maxsum(int nums[],int n) 5 { 6 int dp[n]; 7 dp[0]=nums[0]; 8 int Max=dp[0]; 9 阅读全文
posted @ 2021-05-13 23:15 丁帅帅dss 阅读(50) 评论(0) 推荐(0)
摘要:1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 //递归实现 5 int lcs(int nums1[],int i,int nums2[],int j) 6 { 7 if(i==0||j==0) return 阅读全文
posted @ 2021-05-13 23:14 丁帅帅dss 阅读(51) 评论(0) 推荐(0)
摘要:1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int select(int values[],int n,int weights[],int capacity) 6 { 7 int dp[n+1][capa 阅读全文
posted @ 2021-05-13 23:12 丁帅帅dss 阅读(49) 评论(0) 推荐(0)