不懂得见算法背包问题详解
代码如下:
#include
struct node
{
int cost;
double wei;
} a[10004];
double min(double a,double b)
{ return a>b? b:a;}
int main()
{
int i,j,n,m;
double dp[10004];
whil...
分类:
其他好文 时间:
2014-07-24 17:44:25
阅读次数:
235
回文串的问题很经典,也很常见,涉及到递归,循环,动态规划等方面,这里总结一下几种类型,供以后回顾,有问题请大家指正
1、回文串的判断
leetcode上的题目
bool isPalindrome(const char* src)
{
if(src == NULL)return true;
int end = strlen(src)-1,begin = 0;
while(beg...
分类:
其他好文 时间:
2014-07-24 17:42:06
阅读次数:
262
rtsp://192.168.1.198:554/PSIA/streaming/channels/101Playing rtsp://192.168.1.198:554/PSIA/streaming/channels/101.Connecting to server 192.168.1.198[19...
分类:
其他好文 时间:
2014-07-24 17:18:26
阅读次数:
909
给一个已有的类添加 category@interface ClassName (CategoryName)- (NSString *) Nothin_additionalMmethod;@end可以在category中给类添加扩展方法category通常声明在单独的.h文件中,实现category在...
分类:
其他好文 时间:
2014-07-24 17:02:05
阅读次数:
212
递归算法是不可取的,因为效率很低,而且还有栈溢出的风险。
应该使用如下的迭代解法:
int Fibonacci(unsigned int n)
{
if(n <= 0)
{
return 0;
}
if(n == 1)
{
return 1;
}
int i = 0,j = 1,m;
unsigned int k;
for(k = 2; k <= ...
分类:
其他好文 时间:
2014-07-24 12:24:05
阅读次数:
233
my code:#include #include #includeusing namespace std;int find(int num,int A []){while(num!=A[num])//{ num = A[num];return num;}//bool follow(int a...
分类:
其他好文 时间:
2014-07-24 12:16:25
阅读次数:
175
public class Demo { private String name ; private String getName() { return name; } private void setName(String name) { this.name = ...
分类:
编程语言 时间:
2014-07-24 12:13:45
阅读次数:
273
1 //b.cpp 2 3 #inlcude 4 5 void b() 6 { 7 std::cout<<"fun b"; 8 } 9 10 //a.cpp11 extern void b();12 13 int main()14 {15 b();16 return ...
分类:
编程语言 时间:
2014-07-24 12:12:05
阅读次数:
241
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,...
分类:
其他好文 时间:
2014-07-24 11:28:32
阅读次数:
228
-----------------------------------------ListStu.csusingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
usingSystem.Collections;
namespaceConsoleApplication3
{
publicclassListStu<T>
{
privateQu..
分类:
其他好文 时间:
2014-07-24 10:51:54
阅读次数:
228