2015年11月19日

Python 主要模块和常用方法简览

摘要: 1 ******************** 2 PY核心模块方法 3 ******************** 4 os模块: 5 os.remove() 删除文件 6 os.unlink() 删除文件 7 os.rena... 阅读全文

posted @ 2015-11-19 16:31 hutaishi 阅读(149) 评论(0) 推荐(0) 编辑

2015年11月18日

如何使用Python3连接MySQL

摘要: 网上推荐的Python操作数据库的方法是调用MySQL for Python,也有人称之为MySQLdb,原因是这个是C写的,速度快。 ubuntu下用pip安装第三方库. sudo pip install mysql-python但在python3里面,使用原来py... 阅读全文

posted @ 2015-11-18 20:07 hutaishi 阅读(438) 评论(0) 推荐(0) 编辑

2015年11月15日

Install MySQL-python to connect MySQL

摘要: 传送门# yum -y install MySQL-python运行上面的命令即可安装centos7自带的rpm安装包,但是默认的是为python2.*安装连接MySQL小Demo 1 #-*- encoding:UTF-8 -*- 2 import os, sys, string 3 import... 阅读全文

posted @ 2015-11-15 23:00 hutaishi 阅读(343) 评论(0) 推荐(0) 编辑

2015年9月22日

Best Solver 数论

摘要: Best Solver题目抽象:y = (5 + 2 √6)^(1 + 2 ^ x). 给出整数x和m.求 [y] % m的值。 integerx(0≤x 2 using namespace std; 3 typedef long long LL; 4 5 c... 阅读全文

posted @ 2015-09-22 21:07 hutaishi 阅读(240) 评论(0) 推荐(0) 编辑

2015年9月11日

cf 319 div 2 Modulo Sum 数论+DP

摘要: Modulo Sum题目抽象:给你你一个整数数组,能否从中取出一些树,使得他们的和能被m整除。分析:见代码注释。 1 #include 2 #include 3 using namespace std; 4 const int MS = 1000005; 5 ... 阅读全文

posted @ 2015-09-11 22:05 hutaishi 阅读(163) 评论(0) 推荐(0) 编辑

2015年8月31日

Drainage Ditches 最大流入门练习题,各种算法

摘要: Drainage Ditches题目抽象:n个顶点,m条容量为ci的边组成的图,求源点为1,汇点为n的最大流。分析:各种最大流算法。1.ford() 1 #include 2 #include 3 #include 4 #include 5... 阅读全文

posted @ 2015-08-31 23:43 hutaishi 阅读(240) 评论(0) 推荐(0) 编辑

2015年8月30日

Easy Graph Problem?(一道简单图论题?) bfs + 优先队列

摘要: Easy Graph Problem?题目抽象:给你一个n * m 的矩阵.每个格子是数字或者障碍物'*'. 第一问:从起点到终点的最短路.第二问:要求相同的方向不能连续走两次,也就是每到达一个格子,需要改变方向.问最短路. 不过不存在就输出-1.分析:可以直... 阅读全文

posted @ 2015-08-30 23:52 hutaishi 阅读(365) 评论(0) 推荐(0) 编辑

2015年8月27日

H - 和与积 机智题

摘要: H -和与积题目抽象:构造N个正数(每个数不超过1000000),使所有数的和与所有数的积相差刚好等于D,按非递减序输出. (2= 2 时,而n又比较大时,积会远远大于和.而差却只=2 满足提议. 1 #include 2 #include 3 #in... 阅读全文

posted @ 2015-08-27 19:10 hutaishi 阅读(145) 评论(0) 推荐(0) 编辑

2015年8月24日

cf. Lengthening Sticks 组合数学

摘要: Lengthening Sticks题目抽象:给你四个非负整数a, b,c, l. 问有多少种 a + x, b + y , c +z (其中 x + y + z = 0) 情况使得这三边可以组成三角形.分析:正面组合比较困难. 可以从反面来分析. 首先... 阅读全文

posted @ 2015-08-24 11:04 hutaishi 阅读(152) 评论(0) 推荐(0) 编辑

2015年8月21日

The Doors 最短路 + 简单几何

摘要: The Doors题目抽象:给你一些点,和一些阻碍连边的线段。问原点到终点最短的几何距离。分析:预处理见图之后,跑最短路。 1 #include 2 #include 3 #include 4 #include 5 using nam... 阅读全文

posted @ 2015-08-21 22:20 hutaishi 阅读(163) 评论(0) 推荐(0) 编辑

导航