自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(37)
  • 资源 (1)
  • 收藏
  • 关注

原创 matlab 基本命令

1、矩阵相关 生成一3*3的矩阵 A=[ 1 2 3; 4 5 6 ; 7 8 9] 或者 A=[ 1 2 3 4 5 6 7 8 9]行向量 rowvec=[ 1 2 3] , x=[1:2:100]列向量 colvec=[1;2;3] 分块矩阵生成 E=[eye(2),ones(2,3); zeros(2), [1:3;3:-1:1]] E =

2013-06-13 21:58:35 789

原创 codeforces 187

歇了将近一年后重新做CF A.  比赛时把题目看错了,以为b用来开a,wa了好几次 #include #include #include using namespace std; #define Max 105 int a[Max],b[Max],c[Max]; int main(){ int n; scanf("%d",&n); for (int

2013-06-12 01:09:49 640

原创 合并石子

http://acm.nankai.edu.cn/p1137.html 只有相邻的石子才能合并成堆,十分类似矩阵连乘问题,这里是形成了环,另d[i][j] 表示从第i个元素开始,共j个石子堆的最小得分,c[i][j]表示最大考虑n // category: dp #include #include using namespace std; const int maxn=105; in

2013-05-26 00:59:59 627

原创 python 总结(一)

dive into python 1. str 将数据强制转换为字符串。每种数据类型都可以强制转换为字符串 2. str还可以作用与模块,返回包含了模块在磁盘上的路径名(windows) 3. dir 函数返回任意对象的属性和方法列表,包括模块对象、函数对象、字符串对象、列表对象、字典对象 …… 相当多的东西 >>>dir(odbchelper) ['__builtins__',

2013-04-06 23:52:52 625

原创 python网络编程1 半双工聊天

#!/usr/bin/env python #Filename: socket.py #server端 from socket import * from time import ctime HOST='' PORT=21575 BUFSIZ=1024 ADDR=(HOST,PORT) tcpSerSock=socket(AF_INET,SOCK_STREAM) tcpSerSock.bi

2013-01-29 10:44:48 993

转载 图像矩

source: 点击打开链接 1、概述: 矩函数在图像分析中有着广泛的应用,如模式识别、目标分类、目标识别与方位估计、图像编码与重构等。一个从一幅数字图形中计算出来的矩集,通常描述了该图像形状的全局特征,并提供了大量的关于该图像不同类型的几何特性信息,比如大小、位置、方向及形状等。图像矩的这种特性描述能力被广泛的应用在各种图像处理、计算机视觉和机器人技术领域的目标识别与方位估计中。一阶

2013-01-17 20:59:19 7393

转载 图像卷积与模板

source: 点击打开链接 1.使用模板处理图像相关概念:            模板:矩阵方块,其数学含义是一种卷积运算。       卷积运算:可看作是加权求和的过程,使用到的图像区域中的每个像素分别于卷积核(权矩阵)的每个元素对应相                 乘,所有乘积之和作为区域中心像素的新值。       卷积核:卷积时使用到的权用一个矩阵表示,该矩阵与使用的

2013-01-17 20:27:25 1456

转载 卷积的物理意义

原地址:点击打开链接 卷积这个东东是“信号与系统”中论述系统对输入信号的响应而提出的。因为是对模拟信号论述的,所以常常带有繁琐的算术推倒,很简单的问题的本质常常就被一大堆公式淹没了,那么卷积究竟物理意义怎么样呢? 卷积表示为y(n) = x(n)*h(n) 使用离散数列来理解卷积会更形象一点,我们把y(n)的序列表示成y(0),y(1),y(2) and so on;

2013-01-17 20:21:06 783

原创 uva 540 Team Queue

又是容器没有清除跪了很长时间。。。就是多级队列吧,在链表中维护该group的位置#include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for (int i=0;i<n;i++) #define LL

2012-11-17 11:12:19 479

原创 uva 442 Matrix Chain Multiplication

#include #include #include #include #include #include #include #include #include #include #define rep(i,n) for (int i=0;i<n;i++) #define Max(a,b) a>b?a:b #define Min(a,b) a<b?a:b #define INF

2012-11-16 20:24:25 376

转载 遗传算法入门(连载之四)

(连载之四). . 扎自第三章  清华大学出版社 (本章由zzwu译) 3.3计算机内的进化( Evolution Inside Your Computer )     遗传算法的工作过程本质上就是模拟生物的进化过程。首先,要规定一种编码方法,使得你的问题的任何一个潜在可行解都能表示成为一个“数字”染色体。然后,创建一个由随机的染色体

2012-11-04 13:44:43 539

原创 2012成都赛区网络赛 hdu4292

论文题啦。。。。与poj3281一摸一样.... 每个人有自己喜欢的食物和饮料,算作一个从源到汇的流。关键地方是将人拆成两个点,分别连源和汇,这样就是多源多汇的最大流了。 为什么要拆点呢,因为每个人只能算一种食物一种饮料,不然就有不同的食物流到不同的饮料了。。。 #include #include #include #define NODE_SIZE 10010 #define EDG

2012-09-16 19:47:53 3516 1

原创 2012天津赛区网络赛 hdu 4280 Island Transport

这题比赛时套各种模板都TLE到吐了。。。赛后发现自己2B了,按照以前的模板的写法,每次都是由u->v, v->u各构成一条边,这里的话本来是无向图每次构建从u->v的就行了,汗。。。。不过效率还是很低啊,模板还不够强大,因为也有人构双边sap水过的。。。 当然赛后别人说是平面图构图最短路  http://www.mzry1992.com/blog/miao/9.html #inclu

2012-09-11 20:58:13 674

原创 一个简单的数论问题

问题是这样的: 在一个线段内部任取n个点,将这些点及线段端点依次记为A0,A1,……An+1,A0染为红色,An+1为蓝色,其余点为或者为红,或者为蓝,称两端颜色不同的线段AiAi+1(0 方法一: 红色记为-1,蓝色记为1,考虑每条线段两端数的乘积,当且仅当是好线段时,乘积是-1,将上述n+1个乘积乘起来,这是A0,An+1各出现一次,其他点均为两次,于是最终结果为-1,表明n+1个乘积中,

2012-07-20 18:44:31 640

原创 二叉查找树的操作

#include #include #include using namespace std; typedef struct Node { int data; Node* lc,*rc,*parent; }*BiTree; BiTree root; int a[100]; int n; void CreateTree(BiTree& T ,int v) // 注意此处类型,

2012-07-07 13:58:31 349

原创 poj 2245

#include #include using namespace std; int num; int a[15]; int b[15]; void dfs(int n,int k) { int i; if(k>=6) { printf("%d",b[0]); for(i=1;i<6;++i) printf(" %d",b[i]); printf("\n");

2012-06-24 17:32:18 428

原创 POJ 1411

#include int isprime[10000]={0}; int pr[1500]; int main() { int i,j; for(i=2;i<=101;++i) if(isprime[i]==0) for(j=i;j*i<10000;++j) isprime[j*i]=1; for(i=2,j=0;i<10000;i++) if(!isprime[i])

2012-06-24 16:31:54 579

原创 树状数组简单运用 hdu1166

#include #include #define IN(x) scanf("%d",&x) int enemy[50005]; int tree[50005]; int num; void built(int idx,int value) { while(idx<=num) { tree[idx]+=value; idx+=(idx&-idx); } } int re

2012-06-16 17:24:51 413

原创 POJ 1017

#include using namespace std; int main() {    int a[7];    int pnum;    while(cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6],a[1]||a[2]||a[3]||a[4]||a[5]||a[6])    {   int i,j;   pnum=a[6]+a[5]+a[4

2012-06-10 21:31:50 387

原创 POJ 1017

#include #include int a[7]; bool isok; int value; int v; int dp[100000]; #define max(x,y) ((x)>(y)?(x):(y)) void dfs(int rest,int k) { int i; if(rest==0) { isok=true; return; } els

2012-06-10 19:08:46 375

原创 POJ 1013

#include #include #include #define _abs(x) (x>=0? x:(-x)) int main() { char left[6],right[6],bal[6]; int nCase; scanf("%d",&nCase); int i; for(i=1;i<=nCase;++i) { int ii=3,j; int flag;

2012-06-10 12:59:49 491

原创 POJ 1012

#include #include using namespace std; int a[14]; int flag[14]; void _init() { int i,j,k,m; for(i=1;i<14;++i) { k=i+1; bool isfound=false; int tt; while(!isfound) { int len=2

2012-06-09 22:41:12 365

原创 POJ 1008

//整除时注意下标问题就行了#include #include char HaabCal[19][10]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet

2012-06-09 20:08:13 332

原创 POJ 1005

#include #define Pi 3.14159265 int main() { int nCase,i; scanf("%d",&nCase); for(i=1;i<=nCase;++i) { double x,y; scanf("%lf%lf",&x,&y); double area=(x*x+y*y)*Pi/2; int year=area/50.0; i

2012-06-09 16:33:27 344

原创 POJ 1004

#include int main() { double bal; while(scanf("%lf",&bal)!=EOF) { int i; double sum=bal; for(i=1;i<12;++i) { scanf("%lf",&bal); sum+=bal; } printf("$%.2lf\n",sum/12); } return

2012-06-09 16:16:02 638

原创 POJ 1001

#include #include #include using namespace std; int ans[200]; int intstr[7]; int totallen=1; void cal(int n) { int i,j; int a[200]; memset(a,0,sizeof(a)); for(i=0;i<n;++i) { for(j=0;j<

2012-06-09 16:07:55 455

原创 并查集Hdu 1829 A Bug's Life

//非此即彼的思想,参考庄神ppt,YM庄神,自己太弱了。。。 #include int father[2001]; int gender[2001]; int Find_set(int x) { if(father[x]!=x) { father[x]=Find_set(father[x]); } return father[x]; } void Union(int x,int

2012-04-25 21:02:47 599

原创 并查集 Hdu 1856 More is better

本题是并查集典型题目通过比较各个不相交集合,求出最大的集合包含的元素个数另外本题和其他题目有所区别的地方是本题的rank[x]记录的是x中所含的元素个数,而一般构造法记录的是x在树中的高度,之所以不采用高度的方法是因为并查后统计的规模很大,一个个统计必然超时。因此本题因从并查集构造原理来重新定义#include #define Max 1000001 struct { int x; int

2012-04-25 17:56:39 461

原创 编程中经常出现的错误

每次输入char型数据前如果有输入,必须的用getchar()或者cin.get()接受字符,不然下一轮输入的char型数据就会接收上一轮的'\n' ,导致输入输出出现混乱. 而在C++中就没有这样的问题,主要是他们的缓冲机制不同。 scanf("%d",&n); getchar(); scanf("%c",&a);

2012-04-10 22:29:08 504

转载 哎~

压力不是有人比你努力,而是比你牛叉几倍的人依然比你努力。

2012-04-10 22:12:18 338

原创 hdu1009简单数学题

#include #include struct Rate { double rate; int index; }; void QSort(struct Rate ra[],int p,int r); int partition(struct Rate ra[],int p,int r); using namespace std; #define N 1000

2012-01-23 23:21:56 564

原创 hdu1466

计算直线的交点数  m条直线的交点方案数 =(m-r)条平行线与r条直线交叉的交点数    + r条直线本身的交点方案 =(m-r)*r+r条之间本身的交点方案数(1 #include using namespace std; int main() { int n; int crossPoint[1400]; memset(crossPoint,0,sizeof(cr

2012-01-23 23:15:55 845

原创 hdu1030

hdu 1030 Delta-Wave #include #include using namespace std; int main() { double m,n; int nearest1,nearest2; int layerDistance,tempDistance,realDistance; int placeInRow; while(cin>>m>>n)

2012-01-23 23:12:09 1167

原创 音乐播放器截图(skinMagic)

2012-01-16 22:42:22 485

原创 hdu1241 广度搜索

#include #include using namespace std; char map[111][111]; int fword[8][2]={{1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,-1},{-1,1},{1,-1}}; struct point {  int x;  int y; }; void bfs(const point &p)

2011-12-01 21:02:06 1147

原创 哈夫曼编码

#include   using namespace std; #define Max 15 typedef struct {  unsigned weight;  unsigned p;  unsigned lc;  unsigned rc; }HTNode; int findmin(HTNode* huf,int n,int m); int main() {  in

2011-11-17 17:44:37 528

原创 返回引用的一些好处(编程日记)

在实现一些字符串操作的类中,经常返回一些引用,这样都有哪些好处呢?  类大致如此  class String {  private:      char *str;      int len;      static int num_strings; public:    ... };   1. 在重载 = 操作符时,可以返回引用,如   String & ::Strin

2011-10-28 21:50:17 730

GeoGebra使用指南

动态数学软件GeoGebra使用指南,功能强大的几何描述工具

2014-10-08

空空如也

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

TA关注的人

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