- 博客(7)
- 收藏
- 关注
原创 PAT-1032
1032. Sharing (25)题目地址:http://pat.zju.edu.cn/contests/pat-practise/1032 To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may le
2012-11-22 11:56:48 611
原创 PAT-1040
1040. Longest Symmetric String题目地址:http://pat.zju.edu.cn/contests/pat-practise/1040Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given "Is
2012-11-18 12:16:33 558
原创 PAT-1015
1015. Reversible Primes (20)题目地址:http://pat.zju.edu.cn/contests/pat-practise/1015A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For exa
2012-11-17 18:31:05 577
原创 PAT -1007
1007. Maximum Subsequence Sum 题目地址:http://pat.zju.edu.cn/contests/pat-practise/1007Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ...,
2012-11-17 13:34:55 569
原创 PAT-1038
1038. Recover the Smallest Number 题目地址:http://pat.zju.edu.cn/contests/pat-practise/1038Given a collection of number segments, you are supposed to recover the smallest number from them. For example
2012-11-17 12:17:14 649
转载 0-1背包问题
背包问题有0-1背包问题和fraction背包问题,前者规定每个物品要么选,要么不选,而fraction knanpsack允许选取一个物品的一部分,0-1背包问题是NP难的,而fraction knapsacks的复杂度是O(n*logn), 只需要将单位物品的价值按降序排列,利用贪心策略选取即可得到最优解。给定一个背包,容量为C,有n个物品,重量为n维行向量w,价值为n维行向量v. |v|
2012-11-15 09:26:03 829
转载 endl和'/n'
1.endl是一个特殊值,称为操纵符,将它写入输出流时,不仅具有输出换行的效果,而且它刷新与设备关联的缓冲区,通过刷新缓冲区,用户可立即看到写入到流中的输出;'/n'仅仅是一个换行符,将它写入到输出流时,只能起到一个换行的作用,不能刷新输出。 因此建议,在能用cout 2.#include "stdafx.h"#include #include int _tma
2012-11-10 20:55:56 695
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人