2013年11月17日

Project Euler 7

摘要: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.What is the 10001st prime number?今天一口气搞定了PE的三道题,其实还是不算太难的。要求找到第10001个质数,有了之前做第三题的经验,这道题要轻车熟路得许多。主要思想是,每产生一个质数,记在一个数组里,之后的数(只有奇数)用之前的质数去除,若能被整除则表明不是质数,若之前质数除完都不能整除,则表明这个数是质数。算法:void main(){ int Prim... 阅读全文

posted @ 2013-11-17 23:16 清水老和尚 阅读(235) 评论(0) 推荐(0) 编辑

Project Euler 5

摘要: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?其实也没什么难的,1~20的最小公倍数。首先,把互质的几个数——3,5,7,11,13,17,19相乘,得到4849845,易证得该最小公约数一定是4849845的倍数。然后用遍历法,判断其是否 阅读全文

posted @ 2013-11-17 23:15 清水老和尚 阅读(205) 评论(0) 推荐(0) 编辑

Project Euler 4

摘要: A 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 largest palindrome made from the product of two 3-digit numbers.今天做了PE的第四道题,遇到了一些麻烦,不过比第三题要好些。基于第三题的惨痛经历,拿着这道题,总觉得会有一些很tricky的方法,结果想了半天没有进展。结果看了看别人的解法,原来还是遍历……1 阅读全文

posted @ 2013-11-17 23:14 清水老和尚 阅读(173) 评论(0) 推荐(0) 编辑

C#学习(messageBox,pictureBox,窗口切换)

摘要: 为了做信息论编码的assignment,特意学了下C#,好不容易做出来了,还是好好总结下吧。1.MessageBox的用法:MessageBox.Show(),最常用的方法是:MessageBox.Show(String,String,MessageBoxButtons,MessagBoxIcons),其中第一个String是消息框内要显示的内容,第二个String是消息框的标题。举个例子:MessageBox.Show("How to use messagebox.","Csharp Winform",MessageBoxButtons.OK, Mes 阅读全文

posted @ 2013-11-17 23:03 清水老和尚 阅读(705) 评论(0) 推荐(0) 编辑

导航