上一页 1 2 3 4 5 6 ··· 31 下一页
摘要: #include #include using namespace std;int dp[1005], w[105],v[105],T,M;int max(int x,int y){ return x>y?x:y; }void f( ){ int i,j; for (i=1; i=w[i]; j--... 阅读全文
posted @ 2014-08-18 09:56 2014acm 阅读(113) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;int dp[1005], w[105],v[105],T,M;int max(int x,int y){ return x>y?x:y; }void f( ){ int i,j; for (i=1; i=0; j-... 阅读全文
posted @ 2014-08-18 08:34 2014acm 阅读(155) 评论(0) 推荐(0) 编辑
摘要: #include #define MAX 200int main( ){ int n,i,j,a[MAX][MAX]={0}; scanf("%d",&n); for ( i=0; i#define MAX 200int main( ){ int m,n,i,j,a[MAX][MAX]={0}; s... 阅读全文
posted @ 2014-08-17 15:30 2014acm 阅读(105) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;#define MAX 200int dp[MAX][MAX];int f(int M,int N){ if(M>m>>n) { f(m,n); coutusing namespace std;#def... 阅读全文
posted @ 2014-08-17 13:13 2014acm 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 递归#include using namespace std;int f(int a,int b){if(a>m>>n)cout using namespace std;int f(int a,int b) { if(b==0) return 1 ; if(a>m>>n) cout<<f(m,n)... 阅读全文
posted @ 2014-08-17 11:26 2014acm 阅读(226) 评论(0) 推荐(0) 编辑
摘要: // poj 1458 zoj 1733 最长公共子序列 DP #include #include #define N 1005using namespace std ;char s1[N],s2[N]; int dp[N][N];int max(int a,int b) { return a>b ... 阅读全文
posted @ 2014-08-17 11:10 2014acm 阅读(113) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;#include#define N 1005char s1[N],s2[N];int dp[N][N];int max(int a,int b) { return a>b ? a:b ;}int f(int x ,int y){if(dp[x... 阅读全文
posted @ 2014-08-17 10:48 2014acm 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 选择排序,就是从一列未排序的数组中先选出最小(最大)的数,放在数组的第一位,第一位原来的数字放在最小的原来的位置,再选出第二小的数,放在数组的第二位,第二位原来的数字放在第二小原来的位置~~~~这样说有些绕了哈,简单描述就是每次发现一个最小的、第二小的都让他们分别和第一位的、第二位的数字换位。如此,... 阅读全文
posted @ 2014-08-16 13:28 2014acm 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 插入排序的基本思想是:对于数组前边部分已经是排好序的了,对于接下来的元素查找其在前面的位置,插入之。如下图中1 2 4 7 已经排好序,接下来找到2的位置,插入到1和3之间。之后同样处理4和9.参考程序(C语言实现)如下:#includevoid Insection_Sort(int *A, in... 阅读全文
posted @ 2014-08-16 13:01 2014acm 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 算法描述:1.从第一个元素开始,该元素可以认为已经被排序;(j=0的那个元素)2.取出下一个元素,在已经排序的元素序列中从后向前扫描;10, 5, 2, 4, 75, 10, 2, 4, 72, 5, 10, 4, 72, 4, 5, 10, 72, 4, 5, 7, 103.如果元素(已排序)大于... 阅读全文
posted @ 2014-08-16 12:30 2014acm 阅读(120) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 31 下一页