随笔分类 - 算法与数据结构
摘要:// 0.1背包求解.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> #define N 5 #define ST 10 using namespace std; int main() { //给定n个重量,价值为不同的
阅读全文
摘要:sloves: package BackPack; public class Solves { public int[] DecimaltoBinary(int n,int m) { int r;//求余数 int consult=1;//求商 int j = 0; int []arr=new in
阅读全文
摘要:// KMP.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include<iostream> using namespace std; int BF(char S[], char T[]) { int i=0, j=0; int index = 0; w
阅读全文
摘要:#include"stdafx.h" #include<iostream> #include<cmath> #define TRUE 1 #define FALSE 0 using namespace std; typedef struct Node//坐标点 { double x; double
阅读全文
摘要:// 最大子段和.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include<iostream> using namespace std; int MaxSum_test(int v[], int l, int r) { int k,sum = 0; i
阅读全文