Milking CowsThree farmers rise at 5 am each morning and head for the barn to milk three cows. The first farmer begins milking his cow at time 300 (mea...
分类:
其他好文 时间:
2015-08-29 07:26:04
阅读次数:
260
题意是求长度为N,的且,前i(i为,1,2,3.....N-1)位数字构成的数字都是素数的数字例如2333,其中2,23,233,2333,都是素数/*ID: modengd1PROG: sprimeLANG: C++*/#include #include using namespace std;b...
分类:
其他好文 时间:
2015-08-29 06:10:15
阅读次数:
114
Broken NecklaceYou have a necklace of N red, white, or blue beads (3#include using namespace std;const int maxn=355;int N;char beads[maxn];int calcula...
分类:
其他好文 时间:
2015-08-29 06:07:57
阅读次数:
191
给定两个边界,求输出所有这个边界以内,既是素数又是回文的数字;一开始用的素数筛,爆内存了。改为生成回文后检测是否为素数,在如何递归生成回文上卡了很久。一直纠结于边界情况的处理。/*ID: modengd1PROG: pprimeLANG: C++*/#include #include #includ...
分类:
其他好文 时间:
2015-08-29 00:49:04
阅读次数:
187
数字三角形,最简单的dp之一。不过这次尝试了下滚动数组。/*ID: modengd1PROG: numtriLANG: C++*/#include #include #include using namespace std;int dp[2][1000],input[1001];int main()...
分类:
其他好文 时间:
2015-08-28 21:23:37
阅读次数:
207
给了三个木桶的容量,起始状态下C木桶装满,然后三个木桶相互倒牛奶,问当A木桶为空时的C木桶的牛奶体积的可能情况。直接深度优先搜索,模拟三个木桶相互倒的情况相互倒得情况本可以写的更简洁,但为了可阅读性我并没有这么干不过这道题在本机上调试时,我曾将一个我认为无关紧要的地方写错,因为两个数组大小一样,所以...
分类:
其他好文 时间:
2015-08-28 19:24:26
阅读次数:
142
Friday the ThirteenthIs Friday the 13th really an unusual event?That is, does the 13th of the month land on a Friday less often than on any other day ...
分类:
其他好文 时间:
2015-08-28 19:24:15
阅读次数:
165
Greedy Gift GiversA group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts of money. Each of these friends might or might not ...
分类:
其他好文 时间:
2015-08-28 19:10:32
阅读次数:
154
昨天在USACO做了一道判断素数的题,就想着学习一下Miller_Rabin素数测试算法,在网上找到两种模版,第一种十分简洁,运行速度也很快,但是会判错极少的几个非素数;第二种比较麻烦,运行速度很慢,所以我便想找到第一种模版不能判断的非素数特判一下,结果用了一天,电脑只找到10^8以下的,10^9内还有2个没找到,但正确的模版运行速度太慢,我的电脑又太渣,耗不起时间了,姑且先这样,等以后有深入理解有更好的方法再更新一下。
第一种:源自吉林大学ACM模版
刚开始用的是随机数测试,我想到以前了解过只要用2,7...
分类:
编程语言 时间:
2015-08-28 17:45:12
阅读次数:
205
这道题目还是理解了很久的,英语烂真是头大。题意是,求长度为N,且每个元素都是双平方数(双平方数是指一个数能被写成其他两个数的平方相加)的等比数列的个数。给出长度N,和平方数的范围(两数q,p各小于M;也就是双平方数小于2*M*M)暴搜+简单剪枝/*ID: modengd1PROG: ariprogL...
分类:
其他好文 时间:
2015-08-28 16:57:20
阅读次数:
130