LeetCode Problem -- Best Time to Buy and Sell Stock
Greedy Algorithms 贪心算法...
分类:
其他好文 时间:
2014-06-05 04:36:58
阅读次数:
239
Once an algorithm is given for a problem and
decided to be correct, an important step is to determine how much in the way of resources,such as time or space, the algorithm will require.
...
分类:
其他好文 时间:
2014-06-05 02:14:29
阅读次数:
306
1.php -v 查看版本号
2.php -h 查看帮助
3.php -m 查看安装的模块
4.php -i 查看php信息(查看php.ini非常方便)
5.php --ini 显示配置文件名字
6.php -f 执行php文件...
分类:
Web程序 时间:
2014-06-04 23:49:13
阅读次数:
356
裸dijkstra
思路:以x为源点,求到其他点的最短路,之后把邻接矩阵转置,再求一次x源
点的最短路,这样就一次是来的,一次是走的,相加迭代最大值即可
代码:
/*
poj 3268
8108K 47MS
*/
#include
#include
#define MAXN 1005
#define MAX_INT 2147483647
using namespace s...
分类:
其他好文 时间:
2014-06-04 23:32:57
阅读次数:
303
题目:
链接:点击打开链接
题意:
xx喜欢收集鞋子,n,m,k分别表示鞋子的总数,xx的钱和鞋子的品牌数目。然后给出每个鞋子的信息有:a,是那种品牌,b,鞋子的标价,c,收藏鞋子得到的价值。对于一个收藏家来说,每种品牌的鞋子只收集一种,求出xx能够得到的最大的收藏价值。
算法:
分组背包问题。
思路:
m总的钱数是背包...
分类:
其他好文 时间:
2014-06-04 22:55:34
阅读次数:
270
题意:求一条线上最多几个点
思路:枚举一个点,然后求出过这个点的直线的斜率来求最大值
#include
#include
#include
#include
#include
#include
using namespace std;
const int MAXN = 710;
const int INF = 1e7;
int arr[MAXN][2],n;
float brr[...
分类:
其他好文 时间:
2014-06-04 22:29:53
阅读次数:
333
算法训练 寻找数组中最大值
时间限制:1.0s 内存限制:512.0MB
问题描述
对于给定整数数组a[],寻找其中最大值,并返回下标。
输入格式
整数数组a[],数组元素个数小于1等于100。输出数据分作两行:第一行只有一个数,表示数组元素个数;第二行为数组的各个元素。
输出格式
输出最大值,及其下标
样例输入...
分类:
其他好文 时间:
2014-06-04 21:05:04
阅读次数:
238