2013年11月17日

Project Euler 10

摘要: 今天终于搞完了PE的第十题,说起来这道题做了得有小半个月了。算法类似于PE的第十题,还是用之前的质数去除,以此来判断是否是质数,所以代码就在第七题的基础上稍稍改动一下就可以了。 unsigned long PrimeNum[200000], n, TotalPrime, j; unsigned long long sum; PrimeNum[0] = 2; TotalPrime = 0; sum = 2; for(n = 3; n < = 2000000 ; n = n+2) { for(j = 0; j <= TotalPrime; j... 阅读全文

posted @ 2013-11-17 23:16 清水老和尚 阅读(246) 评论(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 清水老和尚 阅读(214) 评论(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 清水老和尚 阅读(185) 评论(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 清水老和尚 阅读(749) 评论(0) 推荐(0)

导航