问题描述:超市有4种包装的鸡蛋,分别是3个一盒,6个一盒,9个一盒和20个一盒。问顾客要买N个鸡蛋时,所有的组合方案。(Morgen Stanley 2014 
Intern).核心代码: 1 void BuyeggsCore(vector &coins, const int target, int ...
                            
                            
                                分类:
其他好文   时间:
2014-05-16 20:17:07   
                                阅读次数:
289
                             
                    
                        
                            
                            
                                void qsort(void *base, int nelem, int width, int 
(*fcmp)(const void *,const void *));
                            
                            
                                分类:
其他好文   时间:
2014-05-16 08:45:12   
                                阅读次数:
260
                             
                    
                        
                            
                            
                                #include#include#includeusing namespace std;const 
double PRECISION = 1E-6;const int COUNT = 4;const int RESULT = 24;double 
number[COUNT]; //这里一定要用...
                            
                            
                                分类:
编程语言   时间:
2014-05-16 07:12:29   
                                阅读次数:
350
                             
                    
                        
                            
                            
                                ---恢复内容开始---下面是C语言的获取本地时间和构造时间进行格式化时间显示输出的相关函数:This 
page is part of release 3.35 of the Linux man-pages project.#include char 
*asctime(const...
                            
                            
                                分类:
编程语言   时间:
2014-05-15 16:40:30   
                                阅读次数:
300
                             
                    
                        
                            
                            
                                OJ题目:click here~~
题目分析:有n条路径逃出洞穴,第i条路径有一个难度值ci。某人开始有战斗值f,每天随机选择某一条路径想要逃出。只要此时的 f 大于所选路径的ci,就能花费ti的天数逃出。这里。否则,等待明天再试吧,但是战斗值能增加ci。求逃出的期望天数。
设dp[ i ] 为战斗值为i时,逃出的期望天数。详细解释见代码。
AC_CODE
int const maxn =...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 06:38:40   
                                阅读次数:
406
                             
                    
                        
                            
                            
                                /*
* hdu AC Me
* date 2014/5/13
* state AC
*/
#include 
#include 
#include 
#include 
using namespace std;
const int MAXN=100001;
char Arr[MAXN];
int cnt[26];
int main()
{
    //cout << "Hello wor...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 06:16:24   
                                阅读次数:
247
                             
                    
                        
                            
                            
                                面向对象编程--纯虚函数、容器与继承I.纯虚函数	在函数形参后面写上 =0 以指定纯虚函数:class Disc_item : public Item_base
{
public:
    double net_price(size_t) const = 0;	//指定纯虚函数
};
将函数定义为纯虚函数能够说明,该函数为后代类型提供了可以覆盖的接口,但是这个类的版本绝不会调用。重要的是,用户将不...
                            
                            
                                分类:
编程语言   时间:
2014-05-15 05:50:43   
                                阅读次数:
316
                             
                    
                        
                            
                            
                                //拷贝构造函数,什么时候算是 “合适的时候”,才会合成呢~~~
#include 
using namespace std;
class A
{
public:
    A(char *_str):str(_str),x(0){}
    //A(const A&a){cout 
    //如果没有定义的话,对于类A来说,编译器依然不会合成,因为此时的对象之间的...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 05:11:13   
                                阅读次数:
334
                             
                    
                        
                            
                            
                                题目来源:UVa 10308 Roads in the North
题意:求距离最远的2点之间的距离
思路:裸的树的直径 或者树形DP
#include 
#include 
#include 
using namespace std;
const int maxn = 100010;
struct node
{
	int to, w;
	node(){}
	node(int to, int...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 03:37:18   
                                阅读次数:
295
                             
                    
                        
                            
                            
                                在学习Stl的过程中,经常看到->符号的重载,但一直不太明白。 
今天做了一个小测试,来看看如果调用它。 以list的迭代器为例,在 pointer operator->() const { return 
&(operator*());}中加入 cout str_list; str_list.push...
                            
                            
                                分类:
其他好文   时间:
2014-05-14 10:32:52   
                                阅读次数:
221