- 博客(6)
- 收藏
- 关注
原创 section 1.5 sprime
-这道题和section 1.5 pprime思路几乎一模一样 -质数验证函数分了两类,num<=10000和num>=10000"YOUR PROGRAM ('sprime') WORKED FIRST TIME! That's fantastic and a rare thing. Please accept these special automatedcongratulations.
2016-07-08 20:05:09
311
原创 section 1.5 pprime
-先生成回文数 -生成回文数的迭代函数比较复杂,因为是新手,这里处理应该没那么好 -质数判定,先列出sqrt(b)以内的质数表(100,000,000最多只需要列10,000以内),用待测数N依次除以这些质数,求余 -生成质数表的函数很通用 -没有必要用Miller-Rabin算法/*ID: penglin3PROG: pprimeLANG: C++11*/#include <io
2016-07-08 18:42:31
266
转载 快排算法
快排算法目前最为广泛的排序算法#include <iostream>#include<stdlib.h>using namespace std;void Qsort(int a[], int low, int high){ if (low >= high) { return; } int first = low; int last = h
2016-07-06 23:43:55
293
原创 section 1.5 numtri
-首先想到的这个方法太笨了 -还是需要递归算法/*ID: penglin3PROG: numtriLANG: C++11*/#include <iostream>#include <fstream>#include <vector>#include <math.h>using namespace std;//fstream 需要std合法范围#define max(a,b) (a
2016-07-06 19:51:50
242
原创 section 1.4 milk3
首次做的错误-首次做思路是先试图分析倒牛奶过程的数学原理,找到合适的公式。 -其实完全不需要,一次不过六种倒的方案,只需要递归遍历就好了。 -递归判结束的标志是,倒完后的ABC情况前面出现过了。用一个bool数组liter[A][B][C]记录是否已经出现对应情况。程序答案/*ID: penglin3PROG: milk3LANG: C++11*/#include <iostream>
2016-07-06 16:48:26
266
原创 Section 1.4-ariprog
problem: take too much time/*ID: penglin3PROG: ariprogLANG: C++11*/#include//sort 所在头文件,sort是C++的快排函数比qsort好用#include #include #includeusing namespace std;struct arithprog{ int a; int b
2016-07-04 09:49:02
207
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人