上一页 1 2 3 4 5 6 7 ··· 15 下一页
摘要: struct bign { int len, s[numlen]; bign() { memset(s, 0, sizeof(s)); len = 1; } bign(int num) { *this = num; } bign(const char *num) { *this = num; } bign opera... 阅读全文
posted @ 2016-07-20 12:37 Commence 阅读(174) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include const long Size1 = 39L; const long Size2 = 100 * Size1; const long Size3 = 100 * Size2; bool f3(int x) {return x % 3 == 0 ;} bool f13(int x) {return x % 1... 阅读全文
posted @ 2016-07-20 10:26 Commence 阅读(193) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include int main() { using namespace std; cout.setf(ios_base::left,ios_base::adjustfield); cout.setf(ios_base::showpos); ... 阅读全文
posted @ 2016-07-18 00:03 Commence 阅读(274) 评论(0) 推荐(0) 编辑
摘要: set的一个用法 。 difference找差集 union合并set intersection找到交集 阅读全文
posted @ 2016-07-17 19:44 Commence 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题意: 给你一颗n(n<=10^5)个节点树根为1的树,然后进行dfs,求每个点,在dfs中被访问时间的期望。 我们求的就是starting_time[v]的期望pv。 题解: 我们来求一下节点2的期望。 1、我们知道我们要先通过2节点的父亲1才能到2。但2节点什么时候访问是不固定的。 我们假设ri 阅读全文
posted @ 2016-07-17 00:03 Commence 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 要让python程序实现多进程,我们先了解操作系统的相关知识 Unix/Linux操作系统提供了一个fork()系统调用,他非常特殊,普通的函数调用,调用一次,返回一次,但是fork调用一次, 返回两次,因为操作系统自动把当前进程称为父进程复制了一份,然后,分别在父进程和子进程返回。 子进程永远返回 阅读全文
posted @ 2016-06-15 23:21 Commence 阅读(387) 评论(0) 推荐(0) 编辑
摘要: 在程序运行的过程中,所有的变量都是在内存中,比如,定义一个dict: 可以随时修改变量,比如把name改成'Bill',但是一旦程序结束,变量所占用的内存就被操作系统全部回收。如果没有把修改后的'Bill'存储到磁盘上,下次重新运行程序,变量又被初始化为'Bob'。 我们把变量从内存中变成可存储或传 阅读全文
posted @ 2016-06-15 18:50 Commence 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 如果我们要操作文件、目录,可以在命令行下面输入操作系统提供的各种命令来完成。比如dir、cp等命令。 如果要在Python程序中执行这些目录和文件的操作怎么办?其实操作系统提供的命令只是简单地调用了操作系统提供的接口函数,Python内置的os模块也可以直接调用操作系统提供的接口函数。 打开Pyth 阅读全文
posted @ 2016-06-15 16:58 Commence 阅读(393) 评论(0) 推荐(0) 编辑
摘要: 读写文件是最常见的IO操作。python内置了读写文件的函数。 读写文件前,我们先必须了解一下,在磁盘上读写文件的功能都是由操作系统完成的,现代操作系统不允许普通的程序直接对磁盘进行操作,所以, 读写文件就是请求操作系统打开一个文件对象通常称为文件描述符,然后,通过操作系统提供的借口从这个文件中读取 阅读全文
posted @ 2016-06-15 16:34 Commence 阅读(12943) 评论(1) 推荐(1) 编辑
摘要: SQLite是一种嵌入式数据库,它的数据库就是一个文件。由于SQLite本身是C写的,而且体积很小,所以,经常被集成到各种应用当中, 甚至在IOS和Android的APP中都可以集成 Python就内置了SQlite3,所以在Python中使用Sqlite不需要安装。直接使用 在使用SQLite钱, 阅读全文
posted @ 2016-06-15 16:07 Commence 阅读(1130) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 15 下一页