上一页 1 ··· 3 4 5 6 7 8 9 10 下一页

2015年8月29日

usaco Superprime Rib

摘要: 题意是求长度为N,的且,前i(i为,1,2,3.....N-1)位数字构成的数字都是素数的数字例如2333,其中2,23,233,2333,都是素数/*ID: modengd1PROG: sprimeLANG: C++*/#include #include using namespace std;b... 阅读全文

posted @ 2015-08-29 00:36 insaneman 阅读(152) 评论(0) 推荐(0)

usaco Prime Palindromes

摘要: 给定两个边界,求输出所有这个边界以内,既是素数又是回文的数字;一开始用的素数筛,爆内存了。改为生成回文后检测是否为素数,在如何递归生成回文上卡了很久。一直纠结于边界情况的处理。/*ID: modengd1PROG: pprimeLANG: C++*/#include #include #includ... 阅读全文

posted @ 2015-08-29 00:03 insaneman 阅读(162) 评论(0) 推荐(0)

2015年8月28日

6N+/-1素数测试法

摘要: 任何一个数都可以写成:6N,6N+1,6N+2,6N+3,6N+4,6N+5(N为0.1.2.3.....)中的一种形式(因为对任何一个数对6取模一定能得到这其中的一个形式)其中当N大于等于1时,6N,6N+2,6N+4,都能被2整除,6N+3能被3整除。所以6N,6N+2,6N+3,6N+4,都不... 阅读全文

posted @ 2015-08-28 21:53 insaneman 阅读(793) 评论(0) 推荐(0)

usaco Number Triangles

摘要: 数字三角形,最简单的dp之一。不过这次尝试了下滚动数组。/*ID: modengd1PROG: numtriLANG: C++*/#include #include #include using namespace std;int dp[2][1000],input[1001];int main()... 阅读全文

posted @ 2015-08-28 20:45 insaneman 阅读(201) 评论(0) 推荐(0)

usaco Mother's Milk

摘要: 给了三个木桶的容量,起始状态下C木桶装满,然后三个木桶相互倒牛奶,问当A木桶为空时的C木桶的牛奶体积的可能情况。直接深度优先搜索,模拟三个木桶相互倒的情况相互倒得情况本可以写的更简洁,但为了可阅读性我并没有这么干不过这道题在本机上调试时,我曾将一个我认为无关紧要的地方写错,因为两个数组大小一样,所以... 阅读全文

posted @ 2015-08-28 17:21 insaneman 阅读(179) 评论(0) 推荐(0)

usaco Arithmetic Progressions

摘要: 这道题目还是理解了很久的,英语烂真是头大。题意是,求长度为N,且每个元素都是双平方数(双平方数是指一个数能被写成其他两个数的平方相加)的等比数列的个数。给出长度N,和平方数的范围(两数q,p各小于M;也就是双平方数小于2*M*M)暴搜+简单剪枝/*ID: modengd1PROG: ariprogL... 阅读全文

posted @ 2015-08-28 15:20 insaneman 阅读(216) 评论(0) 推荐(0)

2015年8月27日

usaco Ski Course Design

摘要: 只有1000个数,每个数在0到100 之间,暴力可做。/*ID: modengd1PROG: skidesignLANG: C++*/#include #include #include using namespace std;int N;int input[1000];int main(){ ... 阅读全文

posted @ 2015-08-27 21:16 insaneman 阅读(163) 评论(0) 推荐(0)

usaco Wormholes

摘要: 有个数据能在我机子上跑对,在服务器上过不去,卡了我很久。后来才发现,有个数组大小少开了一个。题意是,有头牛只会沿着x轴正方向走,但是y坐标随机。图上有很多虫洞,两两相连,从一个虫洞进去,从对应虫洞出来之后,牛还是会沿着x轴正方向走,让你统计虫洞两两相连的方式,其中会导致牛陷入循环的个数。关于排列组合... 阅读全文

posted @ 2015-08-27 18:44 insaneman 阅读(526) 评论(0) 推荐(0)

usaco Combination Lock

摘要: 用枚举的方法直接计算出所有的可能性,未标记加一,然后标记/*ID: modengd1PROG: comboLANG: C++*/#include #include #include using namespace std;bool vis[101][101][101];int main(){ ... 阅读全文

posted @ 2015-08-27 15:20 insaneman 阅读(163) 评论(0) 推荐(0)

usaco Prime Cryptarithm

摘要: /*ID: modengd1PROG: crypt1LANG: C++*/#include #include #include using namespace std;int input[10],N;bool tag[10000];int counter(){ int ans=0; fo... 阅读全文

posted @ 2015-08-27 14:26 insaneman 阅读(207) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7 8 9 10 下一页

导航