自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

菜鸟

too difficult

  • 博客(17)
  • 收藏
  • 关注

原创 读取一个文件夹下的所有文件

#include #include #include using namespace std;int main(){ _finddata_t file; long lf; //输入文件夹路径 if((lf = _findfirst("D:\\*.*", &file))==-1) cout<<"Not Found!"<<endl; el

2015-10-29 11:51:05 482

原创 opencv下调整图片大小并保存

cvSaveImage()这个第一个参数,我用的是绝对路径才能正确的保存修改后的图片#include #include #include #include #include using namespace std;#pragma comment(lib, "opencv_core242d.lib")#pragma comment(lib, "opencv_highgui242d.l

2015-10-27 22:37:53 2910

原创 POJ 1088 滑雪

动态规划问题#include #include using namespace std;const int MAX=105;int g[MAX][MAX],dp[MAX][MAX];int dir[4][2]={{-1,0},{0,1},{1,0},{0,-1}};int row,col;int rec(int x,int y){ if(dp[x][y]!=0) {

2015-10-24 09:30:15 295

原创 UVA 10217 A Dinner with Schwarzenegger!!!

#include #include #include using namespace std;int main(){ int n; while(cin>>n) { printf("%.2lf ",(-1+sqrt(4*n+1))/2.0); cout<<(int)((1+sqrt(4*n+1))/2)<<endl; } return 0;}

2015-10-22 19:38:53 371

转载 国外程序员推荐:每个程序员都应读的书

编者按:2008年8月4日,StackOverflow 网友 Bert F 发帖提问:哪本最具影响力的书,是每个程序员都应该读的?  “如果能时光倒流,回到过去,作为一个开发人员,你可以告诉自己在职业生涯初期应该读一本,你会选择哪本书呢?我希望这个书单列表内容丰富,可以涵盖很多东西。”  很多程序员响应,他们在推荐时也写下自己的评语。以前就有国内网友介绍这个程序员书单,不过都是推荐数 Top 10的

2015-10-22 00:06:00 356

转载 UVA 1612 Guess

#include#include#include#define maxn 20000using namespace std;struct player{ int score[8];}P[maxn];int n, ID[maxn];int main() { int cas = 1; while(scanf("%d", &n) == 1 && n) {

2015-10-21 23:51:39 499

原创 UVA 11526 H(n)

这道题就是考思维吧。刚开始第一次写,超时了,然后仔细看了H(n)那个函数,发现n/i这个会自动向下取整,意识到会有很多重复的数字,比方说,如果n=10,当i>5时,这个时候,n/i的值都是1,所以就必须优化这个函数!我为了便于思考,自己把n想成100,则i为51~100的值时,n/i都是1,所以我得到一个算法res+=(tmp-n/i)*(i-1),然后注意判断一下条件就解决这个问题了。#incl

2015-10-20 20:28:56 756

原创 UVA 10341 Solve It

简单题目,数学题,二分,不断向中间逼近!#include #include #include using namespace std;double q,p,r,s,t,u;const double EXP=1e-7;double jud(double x){ return p*exp(-x)+q*sin(x)+r*cos(x)+s*tan(x)+t*x*x+u;}int mai

2015-10-19 23:34:51 370

原创 UVA 10340 All in All

简单的字符串问题#include #include #include using namespace std;int main(){ char str0[100000]; char str1[100000]; while(scanf("%s%s",str0,str1)!=EOF) { int lenth1=strlen(str0); int

2015-10-19 23:04:06 396

原创 HDU 2203 亲和串

用了string类,没用到kmp。。。#include #include using namespace std;int main(){ string str1,str2; while(cin>>str1) { cin>>str2; string str3=str1; str1+=str1; //cout<<str1<<endl; if((str1.find(

2015-10-14 00:25:02 500 1

转载 kmp算法的next数组讲解

我们在一个母字符串中查找一个子字符串有很多方法。KMP是一种最常见的改进算法,它可以在匹配过程中失配的情况下,有效地多往后面跳几个字符,加快匹配速度。当然我们可以看到这个算法针对的是子串有对称属性,如果有对称属性,那么就需要向前查找是否有可以再次匹配的内容。 在KMP算法中有个数组,叫做前缀数组,也有的叫next数组,每一个子串有一个固定的next数组,它记录着字符串匹配过程中失配情况

2015-10-11 22:52:21 775

原创 POJ 2406 Power Strings

找到一个最短的循环串,看通过几次的循环得到的这个字符串!#include #include #include using namespace std;int nex[1000005];char str[1000005];void getnex(){ nex[0]=-1; int lenth=strlen(str),i=0,j=-1; while(i<lenth) {

2015-10-08 23:15:47 358

原创 ZOJ-3633-Alice's present

DescriptionAs a doll master, Alice owns a wide range of dolls, and each of them has a number tip on it's back, the tip can be treated as a positive integer. (the number can be repeated). One day,

2015-10-08 13:54:21 525

原创 弱校联萌十一大决战之强力热身 C题

frog is now a editor to censor so-called sensitive words (敏感词). She has a long text p. Her job is relatively simple -- just to find the first occurence of sensitive word w and remove it. f

2015-10-03 11:10:26 1205

原创 弱校联萌十一大决战之强力热身 B题

frog has n integers a1,a2,…,an, and she wants to add them pairwise. Unfortunately, frog is somehow afraid of carries (进位). She defines \emph{hardness} h(x,y) for adding x and y the number of carries

2015-10-02 19:55:06 1209

原创 弱校联萌十一大决战之强力热身 A题

A. Easy MathGiven n integers a1,a2,…,an, check if the sum of th

2015-10-01 22:31:28 685

转载 UVA 10305 Ordering Tasks

开心!我又从书上学会了拓扑排序!从别人博客上转过来的一句话:  关键在于为什么在visit方法的最后将该顶点添加到一个集合中,就能保证这个集合就是拓扑排序的结果呢?  因为添加顶点到集合中的时机是在dfs方法即将退出之时,而dfs方法本身是个递归方法,只要当前顶点还存在边指向其它任何顶点,它就会递归调用dfs方法,而不会退出。因 此,退出dfs方法,意味着当前顶点没有指向其它顶

2015-10-01 22:25:05 467

空空如也

空空如也

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

TA关注的人

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