1 /* 2 ID: neverchanje 3 PROG: TOJ2195 4 LANG: C++11 5 */ 6 #include 7 #include 8 using namespace std; 9 10 char cmd;11 int n,val;12 int main(){13 //....
分类:
其他好文 时间:
2014-07-10 00:08:56
阅读次数:
196
UVA 11426 - GCD - Extreme (II)
题目链接
题意:给定N,求∑i=ni=1∑jnj=1gcd(i,j)的值。
思路:lrj白书上的例题,设f(n) = gcd(1, n) + gcd(2, n) + ... + gcd(n - 1, n).这样的话,就可以得到递推式S(n) = f(2) + f(3) + ... + f(n) ==> S(n) = S...
分类:
其他好文 时间:
2014-06-28 00:01:04
阅读次数:
246
题目
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
For example,
[1,1,2] have the following unique permutations:
[1,1,2], [1,2,1],
...
分类:
其他好文 时间:
2014-06-27 23:53:21
阅读次数:
290
需要注意的是,可以操作两次买卖,但是第二次买入必须在第一次卖出之后才能操作。所以思路就是先正序使用贪心计算每一天之前买入卖出可能达到的最大收益,拿数组记录下来。再逆序计算每一天对应的之后买入卖出可能达到的最大收益,拿数组记录下来。然后将两个数组中每一天对应的两种情况可以实现的收益之和,得到最大值即为可以实现的最大收益。code如下:...
分类:
其他好文 时间:
2014-06-27 23:44:49
阅读次数:
247
Broken Sword II The Smoking Mirror v2.0.09 Android-DeBTPDA美式冒险解谜大作 Broken Sword II The Smoking Mirror非常经典的一款美式冒险解谜大作。游戏精美的画面和细节上的精雕细琢,给人非常华丽的感觉;引人入...
分类:
移动开发 时间:
2014-06-27 18:41:29
阅读次数:
327
一.目的。
在教程(二)(http://blog.csdn.net/u012150179/article/details/32911511)中使用基于Spider实现了自己的w3cschool_spider,并在items.py中定义了数据结构,
在pipelines.py中实现获得数据的过滤以及保存。
但是以上述方法只能爬取start_url列表中的网页,而网络爬虫如google等搜索引擎...
分类:
Web程序 时间:
2014-06-27 09:37:22
阅读次数:
15554
题目#include//最长上升子序列 nlogn//入口参数:数组名+数组长度,类型不限,结构体类型可以通过重载运算符实现//数组下标从1号开始。int bsearch(int a[],int len,int num){ int left=1,right=len; while(left...
分类:
其他好文 时间:
2014-06-26 16:20:12
阅读次数:
236
leetcode: Word Ladder II...
分类:
其他好文 时间:
2014-06-26 14:00:10
阅读次数:
130
动态规划poj3903详解,STL 的lower_bound运用...
分类:
其他好文 时间:
2014-06-26 10:25:10
阅读次数:
660
【题目】
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
For example, given s = "aab",
Return 1 since the palindrome partitioning ["aa","b"] could b...
分类:
其他好文 时间:
2014-06-26 07:48:00
阅读次数:
259