摘要: Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a 阅读全文
posted @ 2017-01-20 23:11 DGSX 阅读(171) 评论(0) 推荐(0) 编辑
摘要: The factorial function, n! is defined thus for n a non-negative integer: 0! = 1 n! = n * (n-1)! (n > 0) We say that a divides b if there exists an int 阅读全文
posted @ 2017-01-20 14:54 DGSX 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 以前求素数总是用一堆数去试除,模有0就不是素数,这样做的实在费劲。 在看别人的代码时发现一个比较优雅的方法。用空间换时间,有些时候是很可行的。 求50000内的素数: 阅读全文
posted @ 2017-01-20 13:01 DGSX 阅读(322) 评论(0) 推荐(0) 编辑