摘要: vector v; v.push_back(3); v.push_back(3); cout << v.size() << " " << v.capacity() << endl; //2 2 v.resize(4, 4); //3 3 4 4, 对已经初始化的位置不会重新进行构造, 所以resize(4,4) 前应该先clear() 或者 resize(0)即可 cout << v.size... 阅读全文
posted @ 2017-03-07 14:15 YaLing 阅读(2094) 评论(0) 推荐(0) 编辑
摘要: chown root /u Change the owner of /u to "root". chown root:staff /u Likewise, but also change its group to "staff". chown -hR root /u Change the owner 阅读全文
posted @ 2016-08-26 09:57 YaLing 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 编译: gcc -g malloc.c -fPIC -shared -o libmalloc.so -std=gnu99 链接: gcc -g test_dlmalloc.c -L. -Wl,-R . -lmalloc -o test_dlmalloc 阅读全文
posted @ 2016-08-18 14:09 YaLing 阅读(214) 评论(0) 推荐(0) 编辑
摘要: /* 基类定义以下三种类型的成员变量: public: 基类和派生类对象都可以访问 protected: 基类和派生类的对象都不可以访问,可以在各自的成员函数中访问 private: 基类和派生类对象都不可以访问,派生类不可以在其成员函数中访问 */ #include <iostream> usin 阅读全文
posted @ 2016-01-28 16:25 YaLing 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 多态是什么?简单来说,就是某段程序调用了一个API接口,但是这个API有许多种实现,根据上下文的不同,调用这段API的程序,会调用该API的不同实现。今天我们只关注继承关系下的多态。#include #include using namespace std;class Father{public: ... 阅读全文
posted @ 2016-01-10 15:07 YaLing 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 在http://libevent.org/ 上下载了libevent-2.0.22-stable.tar.gz参照网上的说法, 1)在以下3个文件开头添加“#define _WIN32_WINNT 0x0500” libevent-2.0.21-stable\event_iocp.c ... 阅读全文
posted @ 2015-12-29 17:24 YaLing 阅读(322) 评论(0) 推荐(0) 编辑
摘要: // print float bits #include <iostream> using namespace std; int main() { float num = 0.15625; int n = *(int*)(void*)# cout<<(n)<<endl; for(int i = 0; 阅读全文
posted @ 2015-12-27 14:57 YaLing 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 题目来源:http://acm.nyist.net/JudgeOnline/problem.php?pid=435题目大意:在一个n*m的方格中可以放入2*1 和 (2*2中缺一个1*1)的方格,求刚好放满的方案数,不能重叠/*** 状态压缩DP, 和POJ 3555题类似,不过稍微复杂一点,... 阅读全文
posted @ 2014-04-10 19:05 YaLing 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=3555题目大意:给出一个数N,在[1, N]中找出有多少个数字含有连续的“49”,是一道简单的数位DP, 可以拿来做模板……#include #include #include using namespace std;typedef __int64 LL;LL digits[30];LL dp[30][10][2];// len表示当前在第几位,pre表示前一位数字是多少,flag表示是否含有49,// limit表示当前位的数字是否有限制, [0,9] OR [0,digits[len]]; LL 阅读全文
posted @ 2014-04-10 15:51 YaLing 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题目来源: http://poj.org/problem?id=2411题目大意:给一个h*w的方格,现给出1*2和2*1的两种小方块,求出把h*w方格铺满的不同方案数(1#include#include#include#include#include#include#includeusing namespace std;int h, w;long long dp[12][2100];void dfs(int r, int c, int cur, int lst) { if(r == 1) { // if r == 1 only have two state if(c ==... 阅读全文
posted @ 2014-04-10 10:58 YaLing 阅读(148) 评论(0) 推荐(0) 编辑