随笔分类 - 备用
摘要:public static final void sendAsJson(HttpServletResponse response, String str) { response.setContentType("application/json;charset=...
阅读全文
摘要:/*堆排序数组实现*/#include #include #define N 8#define M N+1/*队列*/ int rear=N,front=(N+1)/2;//此处有N+1个已入队 void change(int *a,int *b){ int t...
阅读全文
摘要:#include using namespace std;class Base{ protected: Base *next; public: Base(Base *t){ next...
阅读全文
摘要:/* 素数的筛选找法 coder:qpz time:2014-12-15*/ #include #include void Init(char *a,int n){ inti; for(i=0;i<n;i++){ ...
阅读全文
摘要:/*1/1 + 1/2 + 1/3+ 1/4 + ... 在数学上称为调和级数。 它是发散的,也就是说,只要加上足够多的项,就可以得到任意大的数字。 但是,它发散的很慢: 前1项和达到 1.0前4项和才超过 2.0前83项的和才超过 5.0 那么,请你计算一下,要加多...
阅读全文
摘要:#include #include using namespace std; int main( void ) { const double value = 12.3456789; cout << value << endl; // 默认以6精度,...
阅读全文
摘要:srand函数是随机数发生器的初始化函数。原型:void srand(unsigned seed);用法:它需要提供一个种子,这个种子会对应一个随机数,如果使用相同的种子后面的rand()函数会出现一样的随机数。如: srand(1); 直接使用1来初始化种子。不过为...
阅读全文