给PKU JudgeOnline免费版添加Java语言支持

配置文件“serverconfig.property”中记录了如下信息,我们可以按需修改之。

-EOF-

一加一减找余数 判定被7整除

详细原理看Matrix67写的吧。
“一加一减找余数”比较难弄明白。其实这个问题呢,将数字分组后,从左边的第零组开始(注意是第0组),第2n组的数字加上一个最小数使得其和能被7整除,第2n+1组的数减去一个最小的数使得其差能被7整除,被加上的数写在分组数上方,被减去的数写在下方。
至于为什么是先加后减,因为左边的第一组数有可能只有一个数字,而且可能这个数比7小,先减后加就构造不出来可以被7整除的数了咯。其它的咱不研究,记结论先。

PS:那个那个貌似叫做“奇偶位差法”。
-EOF-

Python一键FTP传文件

每天下班前都需要将工作文档上传到FTP服务器,得写好文档后再打开FTP软件->登录->找到要传的文件->上传->关闭软件。久了难免会不烦,反正文档名和上传位置是固定不变,还是把Python拿出来发挥一下它的神威吧。

-EOF-

Project Euler Python解题汇总 005 ~ 010

What is Project Euler?
Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.

这些解基本上都是用Python暴力解出来的,没有经过优化,只求答案不起速度,但是为了知道运算在什么位置了还加了一些额外的附加代码的,哇咔咔。

问题5:
What is the smallest number divisible by each of the numbers 1 to 20?
求1,2,..,19,20的最小公倍数。

问题6:
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
求1至100和的平方与1至100的平方和之差。

问题7:
Find the 10001st prime.
求第10001个素数(质数)。

问题8:
Discover the largest product of five consecutive digits in the 1000-digit number.
在给定的1000个数中,求出连续5个数的最大乘积。

问题9:
Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000.
求满足a+b+c = 1000的勾股数的积。(注:勾股数指满足a^2+b^2=c^2的自然数a,b,c)

问题10:
Calculate the sum of all the primes below two million.
求2,000,000以内所有素数的和。

-EOF-