原创 Python RE模塊中search()和match()的區別

match()函數只檢測RE是不是在string的開始位置匹配, search()會掃描整個string查找匹配; 也就是說match()只有在0位置匹配成功的話纔有返回, 如果不是開始位置匹配成功的話,match()就返回non

原创 Python 頭文件和常用函數

#coding=utf-8 """ @version: ?? @author: Donny @Mail: [email protected] @license: Lan yu @file: ${NAME}.py @time:

原创 Python生成隨機數的一些函數

頭文件: import random 1、生成一個隨機浮點數,範圍是0-1: print random.random() 2、生成指定範圍內的隨機浮點數: print random.unif

原创 詳細記錄python的range()函數用法

使用python的人都知道range()函數很方便,今天再用到他的時候發現了很多以前看到過但是忘記的細節。這裏記錄一下range(),複習下list的slide,最後分析一個好玩兒的冒泡程序。 這裏記錄一下: range(1

原创 Python使用MySQL數據庫(新)

http://www.cnblogs.com/fnng/p/3565912.html

原创 ubuntu16.04怎麼設置寬帶連接

第一步,安裝pppoecof 打開終端,輸入命令sudo apt-get install pppoeconf 安裝成功之後,開始手動配置。 第二步,配置連接 打開終端,輸入命令pppoeconf 接下來會看到一系列配置信息,包

原创 hdu 1015 Safecracker

Problem Description === Op tech briefing, 2002/11/02 06:42 CST === “The item is locked in a Klein safe behind a p

原创 nyoj 1007 GCD(數學題 歐拉函數的應用)

GCD 描述 The greatest common divisor GCD(a,b) of two positive integers a and b,some

原创 hdu 1011(Starship Troopers,樹形dp)

Starship Troopers Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768

原创 Python正則表達式指南

http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html

原创 樹形dp(poj 1947 Rebuilding Roads )

題意: 有n個點組成一棵樹,問至少要刪除多少條邊才能獲得一棵有p個結點的子樹? 思路: 設dp[i][k]爲以i爲根,生成節點數爲k的子樹,所需剪掉的邊數。 dp[i][1] = total(i.son) + 1,即剪掉與所

原创 nyoj 300 (矩陣快速冪)Kiki & Little Kiki 2

描述 There are n lights in a circle numbered from 1 to n. The left of light 1 is light n, and the left of light k (1

原创 矩陣快速冪模板

#include<map> #include<set> #include<queue> #include<stack> #include<vector> #include<math.h> #include<cstdio> #inc

原创 學習python網站

http://code.ziqiangxuetang.com/python/python-dictionary.html

原创 樹形dp入門(poj 2342 Anniversary party)

題意: 某公司要舉辦一次晚會,但是爲了使得晚會的氣氛更加活躍,每個參加晚會的人都不希望在晚會中見到他的直接上司,現在已知每個人的活躍指數和上司關係(當然不可能存在環),求邀請哪些人(多少人)來能使得晚會的總活躍指數最大。 解題