- 博客(7)
- 收藏
- 关注
原创 青岛大学教务爬虫
# -*- coding: utf-8 -*-from PIL import Imageimport ioimport reimport getpassimport requestsimport pytesseractfrom lxml import etreefrom prettytable import PrettyTableclass qdujw: def _
2017-09-29 09:38:43
2858
原创 poj 2251 Dungeon Master
很简单的一道搜索模板题,,给出邻接矩阵,然后需要自己搜索找出起点和终点,剩下的纯粹就是套模板了。#include #include #include#includeusing namespace std;int l,r,c,tx,ty,tz,x,y,z;char a[31][31][31];int book[31][31][31];int ans;struct node{
2016-11-10 19:11:27
235
原创 kmp算法
一种改进的字符串匹配算法#include #include #includeusing namespace std;char a[100],b[100];void getnext(int *next) { int j,k; next[0]=-1; j=0; k=-1; while( j < strlen(b)-1) {
2016-11-09 20:09:44
235
原创 hdu 5113 Black And White(dfs+剪枝)
大体意思是:你需要解决一个类似的问题:有一个包含从1到K一共K种颜色的N×M棋盘,使得任意两个相邻的区块不能有相同的颜色(如果它们的上、下、左、右任意一边的颜色与自身颜色不同)。第i种颜色可以被使用Ci次。因为n,m都很小所以可以用深搜做,需要注意的问题是当最大的一种颜色的剩余使用次数大于剩余未填充格子加一的一般时,必然会出现两个相同颜色相邻的情况,此时需要剪枝。#include #in
2016-11-04 20:36:08
274
原创 Prime Ring Problem
#include #includeusing namespace std;int book[10000],a[20],n;int prime[] = {0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0};/因为n的取值不大,所以直接打是不是素数/void dfs(int st
2016-10-14 16:22:55
182
原创 HDU 1241 Oil Deposits
很简单的一道搜索题,用深搜。#include#includeint book[111][111];char a[111][111];int cot=1;int n,m;void dfs(int x,int y){ int next[8][2]={{0,1},{-1,1},{1,1},{-1,0},{1,0},{-1,-1},{0,-1},{1,-1}}; int
2016-10-14 16:17:41
208
转载 bellman-ford算法
#includeint main(){ int dis[10],i,j,n,m,u[10],v[10],w[10]; int inf=99999999; scanf("%d%d",&n,&m); for(i=1;i { scanf("%d%d%d",&u[i],&v[i],&w[i]); } for(i
2016-09-29 18:39:39
220
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅