2014年10月28日

c++单例

摘要: #include #include using namespace std;class A{public: void printA(){printf("hello A");}};templateclass singleton{private: singleton(); singleton(const... 阅读全文

posted @ 2014-10-28 23:27 kangbry 阅读(135) 评论(0) 推荐(0) 编辑

100步问题

摘要: 回溯问题,可以递归解决,不断试探走一步,走两步 void go(int n,int step,int& sum) { n = n - step; if(n > 0) { go(n,1,sum); go(n,2,sum); } else if(n==0) { sum ++; } } int main( 阅读全文

posted @ 2014-10-28 21:46 kangbry 阅读(143) 评论(0) 推荐(0) 编辑

导航