自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Daze

古今来形形色色无非是戏,天地间奇奇怪怪何必当真!

  • 博客(216)
  • 资源 (3)
  • 收藏
  • 关注

原创 Matlab智能算法之遗传算法(1)

以往写过的一篇文章了,旧了1)Sheffield遗传算法工具箱的安装我共享了下修改过文件名和后缀名的原版工具箱,地址为:http://pan.baidu.com/s/1inVKE安装方法:将整个文件夹复制到matlab安装文件夹中的toolbox文件夹例如:C:\Program Files\MATLAB\R2013b\toolbox文件夹。然

2014-08-04 09:59:17 12845 9

原创 Python在信号与系统中的应用(1)——Hilbert变换,Hilbert在单边带包络检波的应用,FIR_LPF滤波器设计,还有逼格高高的FM(PM)调制

多谢董老师,董老师是个好老师!心情久久不能平静,主要是高频这门课的分析方法实在是让我难以理解,公式也背不过,还是放放吧。最近厌恶了Matlab臃肿的体积和频繁的读写对我的Mac的损害,所以学习了一下Python这一轻量级的脚本,发现“Python自诞生那天就跟科学计算分不开”这个事实。无聊,写写心得。配置环境什么的还是弄了几个晚上的。在Mac下用PyCharm还是很好滴,装上NumPy

2014-06-01 18:53:51 20085 7

原创 Recent Contest #2(Mar 25-Mar31, 2014)

http://acm.hust.edu.cn/vjudge/contest/view.action?cid=43116#overviewH 水题不述。#include using namespace std;bool visit[10005];int main() { int n; while (cin>>n) { memset(visit, 0, sizeof(vis

2014-03-31 09:25:44 1195

原创 poj3694

求双连通分量,利用并查集缩点,形成一棵树,树边肯定都是桥,然后每对点x,y,找原图中x,y点对应的新图中的点,如果不是一个点,则向上找它们的LCA,因为它们之间连了一条边,所以这些点到它们的LCA之间的边都不是割边了,找LCA时,先将两点上升到同一层次,然后一起再向上找父亲节点,其间遇到桥就把桥的标记删除,并且答案减1。这个题比上一个好玩多了。#include using namesp

2014-03-31 09:14:16 2637 1

原创 poj2942

处理图:将各武士看成顶点,不互相仇视的武士存在边,建立无向图。按照题目第一个要求(任意相邻的武士不能互相仇视),将武士分成若干组,每一组在图中是一个双联通分量。然后根据双连通分量性质,判断双连通分量中是否存在奇圈,如果存在,则都参加会议,反之不行。具体的方法是:1) 搜索双连通分量。深度优先搜索过程中,用一个栈保存所有经过的节点,判断割点,碰到割点就标记当前栈顶点的节点

2014-03-31 09:08:08 1758 1

原创 Recent Contest #1(Mar 18-Mar24, 2014)

http://acm.hust.edu.cn/vjudge/contest/view.action?cid=42423#overviewA水题不述B题是重点公式不难想:直接算肯定坑爹,有三种优化方法:1、巧妙地乘法:double calc(int n, double p) { double ans = n * p; double temp =

2014-03-25 21:11:27 1362

原创 poj3352

在做2942前可以先做这个,这也是个建议。首先转载byvoid的一个关于图相关定义的介绍:[点连通度与边连通度]在一个无向连通图中,如果有一个顶点集合,删除这个顶点集合,以及这个集合中所有顶点相关联的边以后,原图变成多个连通块,就称这个点集为割点集合。一个图的点连通度的定义为,最小割点集合中的顶点数。类似的,如果有一个边集合,删除这个边集合以后,原图变成多个连通块,就称

2014-03-16 09:23:26 1738 1

原创 poj2186

Tarjan模板题。建议采用二维vector存储。学习Tarjan时要注意两个数组:int DFN[M]; //深度优先搜索访问次序 int Low[M]; //能追溯到的最早的次序 这是学习的网址:http://www.nocow.cn/index.php/Tarjan算法P.s. Tarjan真心是递归之

2014-03-15 09:31:47 1864

原创 poj3422

这个题建图的时候需要拆点。每个格子都是一个点。把一个点拆成两个,两个点之间有两条路,一个容量为1,权值为那个格子的金钱数。另一条路容量为k-1,权值为0。因为走了一次钱捡起来之后就没钱了。超级源点是n*n*2, 超级汇点是n*n*2+1.#include #include #include using namespace std;#define inf 1 << 30#de

2014-03-13 16:52:04 1501

原创 poj2195

跟上题变化实在是太小了,直接套用模板即可!建图都几乎如出一辙。#include #include #include #include using namespace std;#define M 1005#define inf 1 << 30int n, m;short capacity[M][M];short flow[M][M];short weight[M][M]

2014-03-13 16:12:22 1165

原创 poj2516

最小费用最大流初探。过程极为简单:把边作为边权,然后找超级源点和超级汇点之间的最短路,如果有最短路,则对它增广。http://blog.csdn.net/lin375691011/article/details/18923267这是lin的博客,讲得(网络流的概念)比较详细。这个题的细节都在代码中了,就不再叙述了。#include #include #include usi

2014-03-13 15:21:19 1540

原创 poj1364

没有什么新意了,也没有坑点。#include #include #include using namespace std;#define inf 0x7fffffffstruct node { int to, w, next;} edge[1005];int dis[205], head[205], cnt, c[205], n, m;bool vis[205];

2014-02-26 10:32:20 1330

原创 poj1275

建图规则:注意,当约束条件是>=的时候,采用最长路。如果不想敲最长路(其实就在spfa里面改一个地方。。)的话,可以把他们都同时乘以-1即可了。例如s[i-1]-s[i]>=-t[i] ==> s[i]-s[i-1] add_edge(i,i-1,t[i])。#include #include using namespace std;#define MAXN 25#

2014-02-26 10:18:27 1333

原创 poj3159

图都不用刻意建,按照“最短路”模板题做就行了。。#include #include #include using namespace std;#define MAXN 30005#define INF 9999999#define MAXE 150005typedef struct Edge { int v, w; int next;}Edge;Edge edge

2014-02-26 08:41:17 1811

原创 poj2983

两张图片足矣说明问题。任何形如上述约束条件的取值问题均可转化为差分约束问题。重点:约束图的建立。在Ax详细来说:G(V,E),是一个带权重的有向图,其中V={v0,v1,v2,...,vn};E={(vi,vj):xj-xi那么,1.图中自然就包含一个v0,用于保证图中至少含有一个点(下面代码的超级源点)。2.边集E包含的是每个差分约束的边,再加

2014-02-26 08:32:51 1827

原创 poj1019

暑假一直没过,这次过了。。不易- -。10算两位数哦~#include #include using namespace std;#define M 50000long long a[M], s[M];void init() { a[1] = s[1] = 1; for (int i = 2; i < M; i++) { a[i] = a[i - 1] + (int)

2014-01-23 17:02:36 1004

原创 poj1276

好题!没做出来!。。http://blog.csdn.net/lyy289065406/article/details/6648102#include using namespace std;#define MAXN 10#define MAXCASH 100000int main() { int i, j; int N; int cash; while (cin

2014-01-23 16:33:34 1688

原创 poj1837

基本背包,状态转移方程:#include using namespace std;int dp[21][15005];int main() { int c, g, i, j, k; while (cin >> c >> g) { int c1[25], w[25]; for (i = 0; i < c; i++) { cin >> c1[i];

2014-01-23 16:13:18 780

原创 poj1611

为什么这么简单的题我竟然空下了!!!呃呃呃呃呃呃呃!#include using namespace std;int n, m, k, t, f, p[30001], rank[30001], a, b;int find(int x) { if (x == p[x]) return x; else return p[x] = find(p[x]);}void un(int

2014-01-23 15:35:57 2391

原创 poj3687

谁知道怎么证明算法的正确性?网上都说要逆向拓扑序,不明白为什么,看人家的思路,代码很好写。#include #include #include using namespace std;#define N 210bool map[N][N];int stk[N],n,m,out[N];int main(){ int t; for(cin>>t;t--;)

2014-01-23 15:11:57 1370

原创 poj1905

这个题有两个难点1、解方程图片大了点呵。。Retina屏的水果本就是不错!这方程是超越方程,只有数值解,那怎么办呢?2、二分单调性证明证明如下:上面的方程,另左边等于s,则可推得弧长s与h间关系如下:绘制该函数图像如下:可知该函数是随l和s单增的,故可用二分逼近。上图是刚才那个超越方程的隐函数围道图像,也可证明。另提供几何证明

2014-01-19 10:16:03 1880

原创 poj3273

典型的二分,二分上限是组成一个组,花费是每月花费之和,下线是组成N个组,花费是他们中最大的。单调性容易证明,分成组越少,花费越高,分成组越多,花费越少,呈线性关系,故可以采用二分法求解单调函数极值(最值)。#include #include using namespace std;bool judge(int N, int M, int mid, vector a) { int

2014-01-18 10:02:12 1405

原创 poj3292

打一下表,预处理一下,没有什么难度了。#include "iostream"using namespace std;#define MAXN 1000005int h[MAXN];void hnumbers(){ memset(h, 0, sizeof(h)); for (int i = 5; i <= 1000001; i += 4) {

2014-01-17 21:02:57 1439

原创 poj1850

可以算组合吗?长度为2的字母,一共有C(26,2)个,这很难理解么?然后推一下当前要算的字母在哪个位置即可了。#include #include "string"using namespace std;int c[27][27];void combinations(){ for (int i = 0; i <= 26; i++) { for (int j = 0; j

2014-01-17 18:41:29 1771

原创 poj2965

放到枚举里面了,拿位运算做比较方便。#include using namespace std;#define ROW 4int main(){ bool HANDLES[ROW][ROW] = {false}; char handle; for(int i = 0; i < ROW; ++i) { for(int j = 0; j

2014-01-17 09:18:50 1044

原创 poj1936

挨个儿对着比就行,暴力。#include #include using namespace std;int main(){ string a, b; while (cin>>a>>b) { unsigned long i, j, len1, len2; len1 = a.length(); len2 = b.lengt

2014-01-16 09:18:32 1379

原创 poj3080

字符串的题嘛,水的很,STL解决!很方便。ps,npos比跟.size()比好得多,不必考虑边界问题。这代码效率很低,n^3的#include #include #define MAXN 60using namespace std;int main(){ int t; cin>>t; while(t--) { int n;

2014-01-16 09:01:13 1289

原创 poj1007

结构体二级排序,准则是其逆序数,按照题意来即可,么有压力。#include #include #include using namespace std;struct dna{ int num; string s;}DNA[105];int inversionNum(string s){ int ans = 0; int A, C, G;

2014-01-16 08:50:03 2427

原创 poj3259

用bellman搜索图的负权边。很巧妙的把物理学的负空间的概念迁移了一下,不过这过程也很自然,不怎么难想,写得很快。#include "iostream"using namespace std;#define inf 1e10int dis[1005];struct edge{ int s, e, t;}e[5200];int n, m, w_m;//numbe

2014-01-16 08:27:30 2310

原创 poj1062

中文题,不翻译不解释。#include #include using namespace std;const int MAX=120;int M,N,X,T,V;int map[MAX][MAX];int topo[MAX];int visted[MAX];typedef struct NODE{ int level; int price;}NODE;NO

2014-01-16 08:13:35 1432

原创 poj2418

秒过!一是以前做过,二是这题用map又水了。。唉~#include #include #include #include using namespace std;int main(){    ios::sync_with_stdio(false);    mapint> a;    string name;    int c

2013-12-13 16:33:45 1502 1

原创 poj1442

竟然卡输入??!!有意思么~用堆做不好玩,换了个multiset玩玩,最好还是优先队列哦~PS,这种能用stl解决的数据结构题其实没大有意思。。#include #include #include using namespace std;#define MAXN  30010int num[MAXN];multisetint> 

2013-12-13 16:27:37 1396

原创 poj2442

基本的堆的应用,STL中heap即可搞定。最近手速快了好多啊~#include#includeusing namespace std;#define MAXN 2008int a[MAXN], b[MAXN], sum[MAXN];int main(){    int t;    cin >> t;    while (t--)

2013-12-13 16:02:37 1193

原创 poj2503

扫扫尾,今天把初级的数据结构都完成了它,进军中级图论,算法导论看得很爽!这题没啥好说的,map搞定#include #include #include #include using namespace std;int main(){    string s, a, b;    mapbool> apperance;    m

2013-12-13 15:52:17 1644 6

原创 poj2299

求一下逆序数,因为冒泡交换的准则是大于或者小于,逆序数累加的准则同样也是。#includeusing namespace std;long long  cnt;void merge(int array[], int left, int mid, int right){    int* temp = new int[right - left 

2013-12-01 00:43:42 1366

原创 poj3253

水题赚访问量之第二篇~Huffman编码,优先队列使用。#include #include #include #include using namespace std;int main(){    int n;    while (cin >> n)    {        priority_queue long lon

2013-11-24 20:33:45 945

原创 poj2388

为什么这能出现在训练计划里面而不是水题里面!据说水题能赚访问量?#include #include #include using namespace std;int main(){    int n;    while (cin >> n)    {        vectorint>v;        for (int

2013-11-24 00:47:22 1095

原创 poj1035

字符串,水题,1A。话说我逃课了额。。#include #include using namespace std;string dic[10005];string word[55];bool change(string word, string dic){    int countt = 0;    for (int i = 0;

2013-11-23 09:57:10 1028

原创 poj1274

做这个题是看到另一个刚关注我的童鞋博客的一篇网络流题目总结,说这个题是二分图匹配。也看了看,不难,就顺手做了做。奶牛喜欢哪个棚子就给它连上线,边权是1即可,构造二分图,求最大匹配数。#include using namespace std;#define MAXN 205#define _clr(x) memset(x,0xff,sizeof(in

2013-11-19 23:19:46 1449

原创 poj1273

这是一道网络流模板题,我却10次没有A掉,其中包括2个MLE,3个RE,2个CE。今天真的不适宜敲代码。说点感想:好累!今天晚上本是集训的时间,又是回宿舍了,洗了洗衣服。白天写了两篇论文,说是论文,也就是受力分析了一下,列了个微分方程,做了个拉普拉斯变换,用simulink仿真了一下,用Matlab画了画频响图和波特图,分析了下曲线。没什么创新性可言,这种论文肯定发出去没人要,有人要也是这个杂

2013-11-19 23:16:05 1765 1

Arduino 测量温湿度

DHT11传感器,利用i2c在1602上显示温湿度。

2015-06-04

Python 正则表达式实例

以SDUT教务系统为例,抓取学生成绩并解析,计算GPA

2015-06-04

C++参考手册

C++参考手册,chm格式,对于STL有概述

2013-09-28

空空如也

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

TA关注的人

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