09 2019 档案
摘要:Description Bessie noted that although humans have many universities they can attend, cows have none. To remedy this problem, she and her fellow cows
阅读全文
摘要:题目链接:http://poj.org/problem?id=1258 Description Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet con
阅读全文
摘要:题目链接:http://poj.org/problem?id=2377 Description Bessie has been hired to build a cheap internet network among Farmer John's N (2 <= N <= 1,000) barns
阅读全文
摘要:Description Fermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and
阅读全文
摘要:素数筛:需要一个数组进行标记 最小的素数2,所有是2的倍数的数都是合数,对合数进行标记,然后找大于2的第一个非标记的数(肯定是素数),将其倍数进行标记,如此反复,若是找n以内的所有素数,只需要对[2,n^0.5]进行循环即可,因为n以内的所有数如果不是[2,n^0.5]的倍数,则一定是素数。复杂度:
阅读全文