自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

程序与算法的专栏

我不聪明,但我很努力。

  • 博客(36)
  • 资源 (1)
  • 收藏
  • 关注

原创 【PHP】一个简单的验证码类

初学Php,因为很多地方都涉及到验证码的功能,网上虽然有很多验证码的例子,但是看了之后都不是很满意。于是,自己随便看了一下书,写了一个简单地Php验证码类,可以提供简单的生成一个验证码类。当然,这个类也是刚刚写好,还有很多可以改进的地方。下面是代码。<?php/* 2014/3/28 @程序与算法*/class checkCode{ private $m_fontFile

2014-03-28 14:26:31 1212

原创 [Linux]守护进程

/** @ 守护进程 @ 2015-3-12 */#include #include #include #include #include #include #include #include #include #include volatile sig_atomic_t _running = 1;void sigterm_handler(int arg);in

2015-05-04 11:31:02 401

原创 【C++】常量与变量的区别

程序员面试或笔试,一般都会考到常量与变量的区别。 1. 常量的值不可以修改,任何尝试修改常量的操作都会导致编译错误。而变量可以通过赋值来改变。 2. 常量定义后就不可修改,所以常量在定义时就必须初始化。变量可以定义时暂时不进行初始化。常量初始化的时候必须直接赋值...更多...

2014-03-19 11:40:10 2048

原创 吝啬的国度

描述在一个吝啬的国度里有N个城市,这N个城市间只有N-1条路把这个N个城市连接起来。现在,Tom在第S号城市,他有张该国地图,他想知道如果自己要去参观第T号城市,必须经过的前一个城市是几号城市(假设你不走重复的路)。输入第一行输入一个整数M表示测试数据共有M(1每组测试数据的第一行输入一个正整数N(1随后的N-1行,每行有两个正整数a,b(1输出每组测试数据输N

2014-03-18 14:14:46 595

原创 【C++】关于指针函数

指针函数的运用是面试中的经典题目。

2014-03-14 21:04:57 546

原创 【C++】指针与引用的区别

1. 非空区别。在任何情况下都不能使用指向空值的引用。 一个引用必须指向某些对象。比如说说下面的程序为错误的。int &a; // error指针可以指向一个空的变量。int *p; // correctint *pp = NULL; // correct 2. 合法性区别。在使用引用之前不需要测试其合法性。相反,指针则应总被测试,防止其为空。3. 可修改区别。指针可以被重新

2014-03-14 11:12:24 444

原创 sicily9457. Typo

Description Bessie has just purchased a new laptop computer, but she unfortunately finds herself unable to type well, given the size of her large hooves relative to the small keyboard.  Bessie has

2013-11-26 22:01:08 873

原创 sicily1784. Road Toll

ConstraintsTime Limit: 1 secs, Memory Limit: 64 MBDescriptionThere are N cities, identified from 1 to N. There is one and only one road between every two cities. When somebody goes throu

2013-09-17 12:08:30 440

原创 哈夫曼树的简单编程-Minimum Weight

DescriptionGiven a list of weights w1, w2, ..., wn, we can construct a binary tree with n leaves, where each leaf is marked with one weight. The is called a weighted binary tree. The weight of the

2013-09-02 16:24:22 1084

原创 sicily1166. Computer Transformat

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionA sequence consisting of one digit, the number 1 is initially written into a computer. At each successive time step, the

2013-08-31 22:11:56 485

原创 sicily1687. Permutation

1687. PermutationConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionPermutation plays a very important role in Combinatorics. For example, 1 2 3 4 5 and 1 3 5 4 2 are both 5-perm

2013-08-28 19:41:11 677

原创 sicily1034. Forest

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionIn the field of computer science, forest is important and deeply researched , it is a model for many data structures . Now it’s you

2013-08-28 19:03:33 567

转载 Longest Common Subsequence: Dynamic Programming

Longest Common SubsequenceLongest Common Subsequence ( LCS ),中文可以譯做「最長共同子序列」。它和 LIS 是不一樣的。 LCS 是兩個 sequence ,在各自所有的 subsequence 之中,一模一樣而且最長的那個 subsequence 。s1:2 5 7 9 3 1 2s2:3 5 3 2 8以上例來看, s

2013-08-28 17:01:19 563

原创 sicily1762 排座椅

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription上课的时候总有一些同学和前后左右的人交头接耳,这是令小学班主任十分头疼的一件事情。不过,班主任小雪发现了一些有趣的现象,当同学们的座次确定下来之后,只有有限的D对同学上课时会交头接耳。同学们在教室中坐成了M行N列,坐在第i行第j列   的同学

2013-08-24 15:05:02 677

原创 sicily 1001. Alphacode

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionAlice and Bob need to send secret messages to each other and are discussing ways to encode their messages: Alice: "Let's just u

2013-08-19 23:21:47 863

原创 sicily1010. Zipper

Given three strings, you are to determine whether the third string can be formed by combining the characters in the first two strings. The first two strings can be mixed arbitrarily, but each must stay in its original order. For example, consider forming "

2013-08-19 21:53:10 507

原创 [置顶] sicily1007. To and Fro

1007. To and FroConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionMo and Larry have devised a way of encrypting messages. They first decide secretly on the number of columns and w

2013-08-19 21:53:05 439

原创 sicily1625. Binary Clock

1625. Binary Clock ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription A binary clock is a clock which displays traditional sexagesimal time (military format) in a binary forma

2013-08-19 21:53:00 509

原创 sicily1155. Can I Post the lette

1155. Can I Post the lette ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription I am a traveler. I want to post a letter to Merlin. But because there are so many roads I can wal

2013-08-19 21:52:55 599

原创 sicily1198. Substring

1198. Substring ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription Dr lee cuts a string S into N pieces,s[1],…,s[N].   Now, Dr lee gives you these N sub-strings: s[1],…s[N].

2013-08-19 21:52:50 472

原创 sicily1122. Prerequisites?

1122. Prerequisites?ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription Freddie the frosh has chosen to take k courses. To meet the degree requirements, he must take courses from

2013-08-19 21:52:45 472

原创 sicily1703. Obstacle Course

一道很典型的最短路径的题目。        算法的思想来自于Dijkstra(迪杰斯特拉)算法,大家在这里对这个算法就不介绍了。        可以在学完最短经的算法后,用这道题目当做练手。。我的算法还需要优化一下,代码也需要优化,因为我的代码确实有点乱。。下面的代码仅供参考。。        题目的链接:http://soj.me/1703 #include #inclu

2013-08-19 21:52:40 466

原创 sicily1825. Nickname

其实,这道题目的意思简单的。        大概的意思就是,把找到每一个字符串出现的次数,然后,按照字典顺序把字符串和出现的次数依次输出来。。        题目的链接: http://soj.me/1825         下面是我的代码,还有优化的需要,通过的时间为2.3S,题目限定的时间为3S #include #include #include #inclu

2013-08-19 21:52:34 531

原创 sicily1321. Robot

1321. RobotConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionKarell Incorporated has designed a new exploration robot that has the ability to explore new terrains, this new robot

2013-08-19 21:52:29 1036

原创 sicily1940. Ordering Tasks

1940. Ordering TasksConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only p

2013-08-19 21:52:24 941

原创 sicily6135. Blackjack

鉴于这道题目的数据量并不大,所以,暴力解决就可以啦。。所谓暴力,也就说,三重循环。。题目的链接: http://soj.me/6135 #include #include using namespace std;int main(){ int n, m; int count = 1; while (scanf("%d%d", &n, &

2013-08-19 21:52:19 656

原创 sicily7911. Windows

这道题目,其实不用怎么想,数据有大,不过一次遍历搜索就可以完成。    首先读入数据,储存在数组中,然后从数组的尾部向前面搜索判断,就可以了。。 #include #include using namespace std;int main(){ int t; int n, m; int r, c, w, h, cr, cc;

2013-08-19 21:52:14 395

原创 sicily1294. 高级机密

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription       在很多情况下,我们需要对信息进行加密。特别是随着Internet的飞速发展,加密技术就显得尤为重要。       很早以前,罗马人为了在战争中传递信息,频繁地使用替换法进行信息加密。然而在计算机技术高速发展的今天,这种替换法显得不堪一击。因此密码研

2013-08-18 15:12:26 676

原创 sicily1750. 运动会

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionZEH是一名04级的学生,他除了绩点高,还有运动细胞。有一次学院举办运动会,ZEH发现里面的项目都是他所向披靡的,当然他想获得所有项目的No1,但是一个人的精力总是有限的,ZEH也是只有P(Power的简写,一个大于0且小于1000的整数)的精力。如果精力足

2013-08-18 14:54:46 837

原创 sicily1190. Reduced ID Numbers

这道题目,个人认为比较水。只要利用合适的数据结构就可以很快的通过。个人算法能力不是很好,通过的时间为0.83s,题目要求的时间上限为2s。可以看出,我的以下这个算法并不是很好。代码仅供参考。若有更好的算法,欢迎私信我。共同学习,共同进步。。#include #include #include using namespace std;int main(){ int t;

2013-08-18 14:43:11 567

原创 sicily1134.积木分发

#include using namespace std;class child{public: child(){} int have; int need;};int main(){ int num, sum; while (true) { cin >> num >> sum; if (num == 0) {

2013-08-18 14:43:01 524

原创 sicily8034. F7 Championship

DescriptionThe fictional World Championship of Formula 7 Drivers 2013 was characterized by exciting races and frequent shifts of driver positions on the leaderboard. Antun has missed most of it

2013-08-18 14:42:50 585

原创 sicily4086. 韩信点兵

水题一道,直接暴力解决就行啦。#include using namespace std;int main(){ int t; cin >> t; int a, b, c; while (t --) { cin >> a >> b >> c; int tem = -99; for (int

2013-08-18 14:42:17 578

原创 sicily1137. 河床

//这道题目有点水,读懂题目,一次搜索,然后//然后,标记好每一个位置的最大连续长度即可。。#include #include #include using namespace std;int main(){    int n, k;    int a[30009];    cin >> n >> k;

2013-08-18 14:41:48 636

原创 sicily1146.采药

#include #include using namespace std;int max(int x, int y){ if (x > y) { return x; } else { return y; }}int main(){ int a[102], b[102]; int t, m

2013-08-18 14:41:23 445

转载 sicily1321. Robot

http://linxiaoty.iteye.com/blog/1876251

2013-05-27 10:15:06 485

ASP网站管理

提供一个网站管理系统的源代码,可以参考。对于初学者极有帮助!

2013-08-30

空空如也

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

TA关注的人

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