一、random函数不是ANSI C标准,不能在gcc,vc等编译器下编译通过。
可改用C++下的rand函数来实现。 1、C++标准函数库提供一随机数生成器rand,返回0-RAND_MAX之间均匀分布的伪随机整数。
RAND_MAX必须至少为32767。rand()函数不接受参数,默认以1为种子...
分类:
编程语言 时间:
2014-05-17 03:10:21
阅读次数:
347
题意:给我们两个序列,看能否通过压栈,出栈将第一个序列转换成第二个。思路:将序列 1
依次压栈,同时看是否和序列 2 当前元素相同代码如下:#include#include#define max 100using namespace
std;int main(){ stacks; int...
分类:
其他好文 时间:
2014-05-17 01:47:36
阅读次数:
218
二分搜索思想:bool C(double x)可以得到长度为x的绳子//#define
LOCAL#include#includeint const MAX_N=10005;int const MAX_M=100;double const
INF=100000000;int N,K;double d...
分类:
其他好文 时间:
2014-05-17 00:13:44
阅读次数:
271
题目:Givennpoints on a 2D plane, find the maximum
number of points that lie on the same straight
line.算法分析:定义最大直线为符合相同条件的直线中通过点最多的那条直线。对每个点p,计算其它的点与p形成的...
分类:
其他好文 时间:
2014-05-16 23:26:31
阅读次数:
389
1 /** 2 大意: 求[a,b] 之间 phi(a) + phi(a+1)...+ phi(b);
3 思路: 快速求欧拉函数 4 **/ 5 6 #include 7 #include 8 using namespace std; 9 #define Max
300000010 11 ...
分类:
其他好文 时间:
2014-05-14 00:47:07
阅读次数:
287
1 题目大意给出一个n,求sum(gcd(i,j),014 #include 15 using
namespace std;16 #define Max 100000017 18 long long phi[Max+5],ans[Max+5];19 int
prime[Max/3];20 bool....
分类:
其他好文 时间:
2014-05-13 22:40:58
阅读次数:
251
二分查找的一点思考二分查找算法实现#define
LOCAL#include#include#includeint const MAX_N=21) { int mid=(ub+lb)/2;
if(a[mid]>=k) { ub=m...
分类:
其他好文 时间:
2014-05-13 21:53:37
阅读次数:
328
1 /** 2 大意: 求[1,m], [1,n] 之间有多少个数互素。。。做了 1695
,,这题就so easy 了 3 **/ 4 #include 5 #include 6 #include 7 using namespace std; 8
const long long max...
分类:
其他好文 时间:
2014-05-13 21:28:49
阅读次数:
349
在线gen更新各种依赖包yum-yinstallmakeglibclibaiocompat-libstdc++-33compat-gcc-34compat-gcc-34-c++gcclibXpopenmotifcompat-db1.配置/etc/sysctl.conf
/sbin/sysctl-p
kernel.shmall=2097152
kernel.shmmax=2147483648
kernel.shmmni=4096
kernel.sem=25032000100128
fs.f..
分类:
数据库 时间:
2014-05-13 12:34:13
阅读次数:
404
Max Sum of Max-K-sub-sequence
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5690 Accepted Submission(s): 2059
Problem Description
...
分类:
其他好文 时间:
2014-05-13 11:38:49
阅读次数:
256