先给出通过字符型指针输出字符串的示例代码,如下:#include using
std::cout;using std::endl; int main(){ const char *pszStr = "this is a string";
// 输出字符串 cout int ma...
分类:
其他好文 时间:
2014-05-14 01:33:08
阅读次数:
247
题目来源:POJ 2478 Farey Sequence
题意:输入n 求 phi(2)+phi(3)+phi(4)+...+phi(n)
思路:用类似筛法的方式计算phi(1), phi(2), ..., phi(n) 再求前缀和
#include
#include
#include
//欧拉phi函数
const int maxn = 1000010;
typedef long...
分类:
其他好文 时间:
2014-05-14 01:05:22
阅读次数:
323
lr_paramarr_random()函数的作用为:从一个参数数组中随机抽取一个值并以字符串形式返回。其使用方式及返回方式如下:char *
lr_paramarr_random( const char *
paramArrayName);该函数在某些测试场景下或许比较有用,如随机选择页面中一.....
分类:
其他好文 时间:
2014-05-13 22:55:18
阅读次数:
505
1 /** 2 斯特林(Stirling)公式: 3 4 求 n! 的位数 5 6
ceil函数的作用是求不小于给定实数的最小整数。 7 **/ 8 #include 9 #include 10 #include 11 using
namespace std;12 const doubl...
分类:
其他好文 时间:
2014-05-13 22:06:51
阅读次数:
253
二分查找的一点思考二分查找算法实现#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、目录操作有 mkdir(constchar *pathname,mode_t mode)
创建目录,成功则返回0,若出错则返回-1
int rmdir(const char *pathname)
rmdir可以删除一个空目录,成功则返回0,若出错返回-1
DIR *opendir(const *pathname)
成功则返回指针,若出错则返回NULL...
分类:
其他好文 时间:
2014-05-13 08:06:02
阅读次数:
298
手动模拟。。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define N 10100
#define inf 1000000010
mapx,y;
struct X{
int x,y;
bool operator<(const X&a)const{...
分类:
其他好文 时间:
2014-05-13 07:29:10
阅读次数:
294
容器hash_set是以hash table为底层机制的,几乎所有的操作都是转调用hash table提供的接口。由于插入无法存储相同的键值,所以hash_set的插入操作全部都使用hash table的insert_unique接口,代码如下:
pair insert(const value_type& obj)
{
pair p = rep.insert_unique(obj);
...
分类:
其他好文 时间:
2014-05-13 06:33:44
阅读次数:
303
OneofthefilesthattheaverageUnixsysadminrarelylooksat,almostneverchangesandyetdependsoneverytimeheorsherebootsasystemisthe/etc/inittabfile.Thismodestlittlefilecontrolswhathappenswheneverasystemisrebootedorforcedtochangerunlevels.Let‘stakealookattheconfigurat..
分类:
系统相关 时间:
2014-05-13 04:47:00
阅读次数:
612
ThisisourongoingLinuxcommandserieswherewearegoingtoreviewhowwecanusechkconfigcommandefficientlywithit’savailableparameters.TheChkconfigcommandtoolallowstoconfigureservicesstartandstopautomaticallyinthe/etc/rd.d/init.dscriptsthroughcommandline.Let’sseesome..
分类:
系统相关 时间:
2014-05-13 04:26:32
阅读次数:
469