自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(89)
  • 收藏
  • 关注

原创 python文件读写的小笔记

2016-02-05 17:57:19 401

原创 python小爬虫

遍历一个网页的所有链接,跟网上学的import reimport urllib.requestimport urllibfrom collections import dequeque = deque()vis = set()url = 'http://news.dbanotes.net/'que.append(url)cnt = 0li = []f = open(

2016-02-05 17:53:25 388

原创 python一个简单的小爬虫

晚上废了一个来小时才终于搞完了。。。。中间碰到无数的问题 主要是由于 python版本的问题,网上的好多爬虫教程都是用的python2 而python3相对于python2感觉改了好多=.=python3的urllib2不叫这个名字了,改成了urllib.request还有urlopen.read函数返回的不再是string 而是byte 需要在后面加上句decode('utf-8

2016-02-05 02:07:02 844

原创 nlogn 最长上升子序列

#include #include #include #include #include using namespace std;const int maxn = 500;const int INF = ~0U >> 1;int a[maxn], d[maxn]; /// a原数据 d[i] 表示长度为i的上升子序列里面最大的那个数int n;int main() {

2016-02-04 17:38:52 405

原创 AC自动机模板

#include #include #include #include #include using namespace std;const int maxn = 1000000 + 7;const int type = 26;struct node { node *next[type]; node *fail; int cnt;};node *q[ma

2016-02-03 22:51:44 446

原创 gvim一键编译运行python

在这之前必须要把python添加到系统环境变量里;打开gvim的配置文件在里面添加autocmd BufRead *.py set makeprg=python\ -c\ \”import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r’%’)\”autocmd BufRead *.py set efm=%C\

2016-01-27 13:59:14 4399

原创 windows下gvim隐藏工具栏

在gvim的配置文件_vimrc里面添加set guioptions-=mset guioptions-=Tmap :if &guioptions =~# 'T' \set guioptions-=T \set guioptions-=m \else \set guioptions =T \set guioptions =m \endif保存,如果想启用

2016-01-27 13:56:46 565

原创 windows下taglist的配置

首先下载taglist了 地址taglist下载下载后有两个文件夹 没给我文件夹里面都有一个文件在vim的根目录下面的vimfiles也有两个名字相同的文件夹然后将下载的俩文件复制到对应的vim文件夹里面去下载ctags 地址:catgs下载 把文件解压到某个地方,我解压到了vim的根目录下面去了然后配置vim根目录下面的_vimrc文件,在最后添加上let

2016-01-27 02:09:38 958

原创 windows::gvim配置pydiction详细过程

首先下载pydiction  地址http://www.oschina.net/p/pydiction解压之后有这几个文件我的vim的安装目录是E:\Program Files (x86)\Vim 这个因人而异然后将after\ftplugin里面的python_pydiction.vim文件复制到vim根目录下的vimfiles\ftplugin然后将complete-d

2016-01-27 01:44:32 1823

原创 UVA - 11136 Hoax or what

#include #include #include #include using namespace std;const int maxn = 100000 + 7;const int INF = ~0U >> 1;typedef long long LL;multiset s;int n, k;int main() { while(scanf("%d", &n)

2016-01-26 02:21:07 365

原创 uva 1326

#include #include #include #include #include using namespace std;const int maxn = 25;int n;map tab;int A[maxn];char s[1024];int bitcount(int x) { return x == 0 ? 0 : bitcount(x / 2) + (x &

2016-01-25 21:16:42 547

原创 1330 - City Game

好题,但是刘汝佳老师的思路更叼!#include #include #include #include using namespace std;const int maxn = 1000 + 7;int mat[maxn][maxn], up[maxn][maxn], left[maxn][maxn], right[maxn][maxn];int T, m, n;int ma

2016-01-25 15:15:00 402

原创 1121 - Subsequence

尺取法的应用#include #include #include #include #include using namespace std;const int maxn = 100000 + 7;const int INF = ~0U >> 1;int n, S, ans;int a[maxn];int main() { while(scanf("%d%d",

2016-01-25 13:52:48 302

原创 floyd判圈算法 (UVA 11549 - Calculator Conundrum)

floyd判圈算法的应用这个算法的主要思想是可以假设有俩小孩在同一起跑线上开始跑,第二个小孩的速度是第一个小孩的两倍,如果有环的话,则两个小孩会在某一时刻相遇,如果没有环的话则永远不会相遇例子UVA 11549 - Calculator Conundrum#include #include #include #include #include #include using

2016-01-24 17:45:06 516

原创 Baby Ming and Matrix games(BC)

dfs,比较简单#include #include #include #include #include #include using namespace std;const int INF = ~0U >> 1;const int maxn = 50;const int dx[] = {-1, 0, 1, 0};const int dy[] = {0, 1, 0, -1}

2016-01-23 20:51:26 411

原创 Baby Ming and phone number(BC)

水题,但是做的时候犯了个极其脑残的错误。。#include #include #include #include #include #include using namespace std;const int INF = ~0U >> 1;const int maxn = 1000;typedef long long LL;int T, n, a, b;char str[

2016-01-23 20:44:49 534

原创 Baby Ming and Weight lifting(BestCoder)

纯暴力,做的时候太心急了错了两遍。。#include #include #include #include #include #include using namespace std;const int maxn = 100010;int T, n;int main() { scanf("%d", &T); while(T--) { int

2016-01-23 20:43:06 347

原创 1428 - Ping pong

树状数组。#include #include #include #include #include using namespace std;const int INF = 100000 + 7;const int maxn = 20000 + 7;typedef long long LL;int T, n, MAX;int left_[maxn], right_[maxn];

2016-01-23 16:07:16 345

原创 10026 - Shoemaker's Problem

贪心#include #include #include #include using namespace std;const int maxn = 1000 + 7;int T, n;struct node { int fine, time; double d; int id; bool operator<(const node& rhs) co

2016-01-23 14:32:53 431

原创 ZOJ 3890

BFS#include #include #include #include #include #include using namespace std;const int INF = ~0U >> 1;const int maxn = 20 + 7;const int dx[] = {-1, 0, 1, 0};const int dy[] = {0, 1, 0, -1};

2016-01-22 21:30:28 322

原创 10970 Big Chocolate

哈哈哈#include #include using namespace std;int main() { int a, b; while(scanf("%d%d", &a, &b) != EOF) { printf("%d\n", a * b - 1); } return 0;}

2016-01-20 15:21:17 316

原创 11078 Open Credit System

#include #include #include #include using namespace std;const int INF = 150000 + 7;int T, n;int a, b;int r[100007];int main() { scanf("%d", &T); while(T--) { scanf("%d", &n);

2016-01-19 20:54:37 942

原创 11520 - Fill the Square

纯暴力。#include #include #include #include #include using namespace std;const int maxn = 20;const int dx[] = {-1, 0, 1, 0};const int dy[] = {0, 1, 0, -1};int T, n, kase = 0;char str[maxn][maxn]

2016-01-19 15:17:24 435

原创 11210 - Chinese Mahjong

#include #include #include #include #include #include using namespace std;const int maxn = 34;const char* majiang[] = { "1T", "2T", "3T", "4T", "5T", "6T", "7T", "8T", "9T", "1S", "2S"

2016-01-18 16:49:56 481

原创 11464 Even Parity

#include #include #include #include #include #include using namespace std;const int INF = ~0U >> 1;const int maxn = 20;const int dx[] = {0, -1, 0, 1};const int dy[] = {-1, 0, 1, 0};int T, n

2016-01-17 20:38:55 395

原创 11464 Even Parity

#include #include #include #include #include #include using namespace std;const int INF = ~0U >> 1;const int maxn = 20;const int dx[] = {0, -1, 0, 1};const int dy[] = {-1, 0, 1, 0};int T, n

2016-01-17 20:36:19 336

原创 mysql 服务无法启动

有的mysql安装完了以后服务并没有启动,这时候就需要用cmd命令提示符来解决。首先这个cmd要以管理员的身份打开,如果打开的cmd不是管理员身份,那就去找C盘的windos文件夹里的system32文件夹下的cmd.exe,右键这个文件,有个“以管理员身份打开”,点击以后打开的cmd就是管理员身份。然后切换到mysql的bin目录下,比如D:\MySQL5.1\bin这个文件下然后输入m

2015-11-13 17:54:43 522

原创 poj2481

/**对所有牛按先左端点s从小到大排序,如果s相等则按e从大到小排序 **//**这样遍历的时候只需要满足某个点在该点左边就可以了 **/#include #include #include #include #include using namespace std;const int maxn = 100000 + 7;struct node{ int x, y,

2015-11-04 16:16:45 551

原创 poj2481 树状数组

/**对所有牛按先左端点s从小到大排序,如果s相等则按e从大到小排序 **//**这样遍历的时候只需要满足某个点在该点左边就可以了  **/#include #include #include #include #include using namespace std;const int maxn = 100000 + 7;struct node{   

2015-11-04 16:14:45 366

原创 hdu2795

#include #include #include #include #include using namespace std;const int maxn = 200000 + 7;struct node { int left, right; int val;} str[maxn*10];int w, h, n;int ans = -1;void Bui

2015-11-03 23:34:11 312

原创 循环遍历HashMap的较快方法

package MAIN;import Book.*;import java.util.*;public class slove { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String name; int val

2015-11-02 18:30:27 506

原创 POJ3083 Children of the Candy Corn(DFS + BFS)

DFS求左贴墙和右贴墙 BFS求最短路我用的方向顺序是 上=0 右=1 下=2 左=3注意要贴墙走,详细见代码#include #include #include #include #include #include using namespace std;const int maxn = 40 + 5;const int INF = ~0U >> 1;const i

2015-10-25 17:18:01 369

原创 sg函数模板

///f[]:可以取走的石子个数///sg[]:0~n的SG函数值///hash[]:mex{}int f[K],sg[N],hash[N];void getSG(int n) { memset(sg,0,sizeof(sg)); for(int i = 1; i <= n; ++i) { memset(hash,0,sizeof(hash));

2015-10-16 22:33:45 399

原创 UVa1262 - Password

不知道哪错了。。0.0#include #include #include #include #include #include using namespace std;const int INF = ~0U >> 1;const int maxn = 7;char s1[maxn][maxn], s2[maxn][maxn];string str[maxn];int T

2015-10-08 21:49:45 458

原创 UVA808 - Bee Breeding

参考某神牛的解题思路。。orz#include #include #include #include #include #include #include using namespace std;const int INF = ~0U >> 1;const int maxn = 30000+10;const int nx[] = {-1, 0, 1, 1, 0};cons

2015-10-08 20:06:03 1169

原创 UVA1641 - ASCII Area

其实思路很简单的。。一行一行的扫,在两个/ \之间的点就是黑色要求的#include #include #include #include #include #include using namespace std;const int INF = ~0U >> 1;const int maxn = 100+5;int m, n;char str[maxn][maxn];

2015-10-07 19:39:18 504

原创 UVA11971 - Polygon

这题会爆int 导致RE。#include #include #include #include #include #include #include using namespace std;const int INF = ~0U >> 1;const double eps = 1e-8;const double pi = acos(-1.0);typedef long

2015-10-07 18:57:41 473

原创 uva 10801 - Lift Hopping

裸最短路算法一开始因为k=0的情况应该输出0而错了几遍、#include #include #include #include #include #include #include using namespace std;const int maxn = 100+5;const int INF = ~0U >> 1;struct node { int from,

2015-10-05 21:06:47 373

原创 UVa 437. The Tower of Babylon

把所有的正方体形态全求一遍,然后就是裸DAG了#include #include #include #include #include #include using namespace std;const int INF = 0x7fffffff;const int maxn = 300;struct node{ int c, k, g; void sc(i

2015-09-20 22:25:49 445

原创 uva 10048 - Audiophobia(floyd 的变形)

把Floyd算法变一下形就可以了#include #include #include #include #include using namespace std;const int maxn = 100+10;const int INF = 0x7fffffff;int m, n, qu;int d[maxn][maxn];void floyd(){ for(i

2015-09-16 22:20:36 440

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除