杰拉斯的博客

[ACM_ZJUT_1089]Ugly Numbers

杰拉斯 杰拉斯 | 时间:2012-03-28, Wed | 10,296 views
编程算法 

Ugly Numbers

Time Limit:1000MS  Memory Limit:32768K

Description

Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, ... shows the first 11 ugly numbers. By convention, 1 is included. Write a program to find and print the n’th ugly number.

Input

Every integer number (≤1500)describing position of ugly number from 1.If integer number is 0,the process should ended. Maybe there are 10000 integer numbers on input data.

Output

Every integer given should output a line as shown below, The <n>th ugly number is <number>. with <n> replaced by the integer number and <number> replaced by the number computed.

(阅读全文…)

[ACM学习心得]关于sync_with_stdio(false);

杰拉斯 杰拉斯 | 时间:2012-03-27, Tue | 25,368 views
编程算法 

在网上查看别人的ACM代码时,发现别人输入输出语句用的总是scanf与printf,有点不解,还以为他们用的都是C语言,而非C++,但今天做的一道题(Sort):

发现与网上的其他高手使用完全相同的方法,使用scanf及printf的代码提交后Accepted,而使用cin及cout的却Time Limit Exceeded

(阅读全文…)

[转]当代大学生,没我们想象的那么堕落

杰拉斯 杰拉斯 | 时间:2012-03-06, Tue | 7,550 views
心路历程 

近十年来,社会给当代大学生很多负面评价,说他们是垮掉的一代、迷惘的一代、没有责任感、没有使命感、急功近利、蝇营狗苟的一代。或许这些负面的特征他们确实具有。 但我们做平心之论,这些特征难道是他们独有的吗?

赶上文革结束后头班车进城的大学生难道就没有这些问题,为了获得一张进城的车票,他们会拿着高考复习资料背着昔日的手足兄弟躲到密林蒿草里去苦读(见刘震云小说《塔铺》)。这不是自私是什么?很多人一进城一上大学就抛弃了乡下的患难之交糟糠之妻,这不是背信弃义是什么?我们原谅70年代大学生的一些不轨行为,缘于对他们遭受了太多的苦难的同情。

80年代的大学生还是社会的宝贝,还是天之骄子,他们一面受着启蒙思想的滋养,积极干世,充满了批判精神和参与意识,同时他们又深受欧风美雨的洗礼,他们反传统道德、否定传统的价值观、将骑在传统的脖子上撒野视为潇洒。我们尽管对他们的行为充满惶惑和恐惧但最终还是以改革的名义接受了他们。

90年代后期的大学生最苦,他们目送免费公派的师兄师姐潇洒而去,自己却要承担昂贵的学费和沉重的就业压力。无节制的高校扩招又让他们丧失了天之骄子的光环。他们失去太多,社会却没有给他们以应有抚慰和疏导,却一味的责怪他们的浮躁和喧嚣。久经磨练的成人尚且不堪如此变化,何况少不更事的莘莘学子。现时代的大学生和90年代后期的大学生生存环境基本相似,但大学学历更加贬值,就业压力更大,就业环境更加严峻。好在经历了上十年的残酷现实的教育,大学生已渐渐习惯被社会边缘化的事实。大学生是什么,他们清醒自己不再是什么天之骄子,他们也不够以知识分子相称,社会没有要他们参与批判和质疑,充其量他们只是有点知识的待业者。改革二十年的成果没让他们充分分享,但改革的沉重包袱却毫不犹豫地让他们去背负。他们比任何时代的学生承当的压力都大,他们没有遭遇主流舆论提及的机遇。生存的哲学变得越来越坚硬。

(阅读全文…)

[整理]ACM详解(9)——其他

杰拉斯 杰拉斯 | 时间:2012-02-17, Fri | 6,690 views
编程算法 
有时候会考一些锻炼基本能力的题目,下面使用几个例子进行简单分析。
1IP Address
Description
Suppose you are reading byte streams from any device, representing IP addresses. Your task is to convert a 32 characters long sequence of '1s' and '0s' (bits) to a dotted decimal format. A dotted decimal format for an IP address is form by grouping 8 bits at a time and converting the binary representation to decimal representation. Any 8 bits is a valid part of an IP address. To convert binary numbers to decimal numbers remember that both are positional numerical systems, where the first 8 positions of the binary systems are:
27 26 25 24 23 22 21 20
128  64 32 16 8   4   2   1
Input
The input will have a number N (1<=N<=9) in its first line representing the number of streams to convert. N lines will follow.
Output
The output must have N lines with a doted decimal IP address. A dotted decimal IP address is formed by grouping 8 bit at the time and converting the binary representation to decimal representation.

(阅读全文…)