摘要: 因为有个Bash脚本,想根据用户给的日期参数(yyyymmdd格式),得到这个日期的前一天的表示。首先想到的就是date命令,网上搜了一大把,其实多数都是互相抄的,date基本用法原本就会,不能用来解决我的问题。先说不用date命令的方法:不嫌麻烦就多用几个判断,解决每月开头、每年开头减去一... 阅读全文
posted @ 2010-12-06 16:18 阿债 阅读(161) 评论(0) 推荐(0)
摘要: 0.目标安装 pylibmc http://pypi.python.org/packages/source/p/pylibmc/pylibmc-1.1.1.tar.gz#md5=e43c54e285f8d937a3f1a916256ecc851.环境Ubuntu Server 10.04 ... 阅读全文
posted @ 2010-06-17 11:49 阿债 阅读(191) 评论(0) 推荐(0)
摘要: E0052520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest number that is ... 阅读全文
posted @ 2010-04-22 17:19 阿债 阅读(109) 评论(0) 推荐(0)
摘要: E004A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.Find the l... 阅读全文
posted @ 2010-04-22 17:05 阿债 阅读(136) 评论(0) 推荐(0)
摘要: E003The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ?求600851475143的最大质因子。今天重写了求素数的方法# -... 阅读全文
posted @ 2010-04-22 16:20 阿债 阅读(115) 评论(0) 推荐(0)
摘要: E002Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: ... 阅读全文
posted @ 2010-04-22 15:32 阿债 阅读(141) 评论(0) 推荐(0)
摘要: 有个很有意思的网站 ProjectEuler.net ,提出了200多道数学问题,要求读者用计算机求解,不限制所用的计算机语言。(2008年11月)试着用Python做了几道,挺有意思的。 Add all the natural numbers below one thousand that... 阅读全文
posted @ 2010-04-22 15:30 阿债 阅读(135) 评论(0) 推荐(0)
摘要: 昨天在地铁上,突然想到当天是21号,星期一。打开手机看了一下,2001年1月1号正好是星期一。于是就有一个有趣的问题:那么21世纪中(2001-2100),每个月的1号,同时又是星期一的日子大约有多少天:A. 50 B. 150 C. 350 D. 550当然,答案是后来设计的。当时我考虑这... 阅读全文
posted @ 2010-04-17 17:40 阿债 阅读(149) 评论(0) 推荐(0)
摘要: 1. JS中数值字符串相加var a='2.1'; var b='13';var c=a+b; 则c的值为 2.113,因为+在字符串间是连接符。如果要求a与b的和,则先要把a、b用parseFloat()或parseInt()转化为浮点数、整数黑客方法 var c=a-0+b; 因为 – ... 阅读全文
posted @ 2010-04-17 17:30 阿债 阅读(125) 评论(0) 推荐(0)
摘要: 当你的硬盘分区不小心被覆盖了,你首先想到的是什么软件?国产软件DiskGen?在你毁掉分区表之前,你又备份分区表就有用,可惜大多数人都没有这个习惯。如果靠它扫描找回分区表,基本没戏。俄罗斯的R-Studio,这是很好的扫描并记录每个扇区的软件,可以立即把硬盘信息想、记录下来,防止后面的不当操... 阅读全文
posted @ 2010-04-17 17:22 阿债 阅读(332) 评论(0) 推荐(0)