杰拉斯的博客

归档:2012年4月月

[ACM_ZJUT_1058]Humble Numbers

杰拉斯 杰拉斯 | 时间:2012-04-10, Tue | 6,308 views
编程算法 

Humble Numbers

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 8472 Accepted Submission(s): 3684

Description

A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers.

Write a program to find and print the nth element in this sequence

Input

The input consists of one or more test cases. Each test case consists of one integer n with 1 <= n <= 5842. Input is terminated by a value of zero (0) for n.

Output

For each test case, print one line saying "The nth humble number is number.". Depending on the value of n, the correct suffix "st", "nd", "rd", or "th" for the ordinal number nth has to be used like it is shown in the sample output.

(阅读全文…)

[ACM_ZJUT_1021]ACMICPC(暴力破解VS动态规划)

杰拉斯 杰拉斯 | 时间:2012-04-09, Mon | 18,034 views
编程算法 

ACMICPC

Time Limit:1000MS Memory Limit:32768K
Description:

Description

大写字母A-Z分别对应整数[-13,12],因此,一个字符串对应了一个整数列。我们把字符串对应的整数列的和称为该字符串的特性值。例如:字符串ACM对应的整数列为{-13,-11,-1},则ACM的特性值为(-13)+(-11)+(-1)=-25;其子串AC的特性值为-24;子串M的特性值为-1。 给你一个字符串,请找出该字符串的所有子串的最大特性值。

Input

第一行的正整数 N(1<=N<=1000)表示其后有N组测试数据,每组测试数据都由一个字符串组成。字符串只能由大写字母A-Z组成,且字符串的长度不会超过1000。

Output

输出有N行,每行是一组测试数据的输出结果。

(阅读全文…)

[第11届华南农业大学ACM程序设计竞赛 网络同步赛]题目及现场作答代码

杰拉斯 杰拉斯 | 时间:2012-04-07, Sat | 6,311 views
编程算法 

A. Local Minimum

Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 220 Accepted Submission(s) : 100

Description

There is an array contains n integers, no any 2 integers are same. Local minimum means an integer is less than its previous one and next one (ie. M[i-1] >M[i] < M[i + 1], 1 < i < n). The array is special, it is guarantee M[1] > M[2] and M[n - 1] < M[n]. Now, give you the array, please find out is there a local minimum exist in the array.

Input

The 1st line of input contains only 1 integer T (T <= 10), indicate the number of test cases.
The 1st line of each test case contains only 1 integer n (3 <= n <= 100), indicate the size of the array.
The 2nd line of each test case contains n integers, indicate the element of the array, the maximum of the integers will not exceed 100.

Output

For each test, if there is local minimum exist, please print "Yes", and otherwise print "No".

(阅读全文…)

WordPress速度优化之缓存Gravatar头像(SAE版1.2)

杰拉斯 杰拉斯 | 时间:2012-04-07, Sat | 51,711 views
后台技术 

什么是Gravatar?

Gravatar Logo

Gravatar是Globally Recognized Avatar的缩写,是gravatar推出的一项服务,意为“全球通用头像”。如果在Gravatar的服务器上放置了你自己的头像,那么在任何支持Gravatar的blog或者留言本上留言时,只要提供你与这个头像关联的email地址,就能够显示出你的Gravatar头像来。

(阅读全文…)

PHP时间格式化函数:date()

杰拉斯 杰拉斯 | 时间:2012-04-06, Fri | 18,413 views
后台技术 

PHP中可以使用date函数对服务器的时间进行格式化。

  • 语法:string date(string format, int [timestamp]);
  • 示例:date("Y-m-d H:i:s", time())
  • 返回值:字符串
  • 函数种类:时间日期
  • 内容说明:返回值的 字符串依配置的格式来决定。若有传入时间戳记值,则将时间戳记格式化返回;若无传入时间戳记值,则将目前服务器的时间格式化返回。要将日期转为其它的语系格式,应使用setlocale() 及 strftime() 二个函数。

(阅读全文…)