先给出通过字符型指针输出字符串的示例代码,如下:#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
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
1、char向int转换
方法一:(适用于单个字符)
char ch = '6';
int num = ch - '0'; //此时num=6
方法二:(适用于字符串)
函数atoi: int atoi ( const char * str );
参数是一个char类型的数组,不能是单个char变量
char str[10] = "32352";
int num = atoi(...
分类:
其他好文 时间:
2014-05-13 06:55:14
阅读次数:
362
容器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
题目来源:POJ 1006 Biorhythms
题意:给出3个周期第一次发生的时间 和 当前开始的天数 求三个周期下一次到达高峰期发生在哪一天
思路:这题很水 试一下我的模版而已
#include
#include
using namespace std;
typedef long long LL;
const int maxn = 10;
int a[maxn], m[maxn];
...
分类:
其他好文 时间:
2014-05-13 05:07:28
阅读次数:
253
unit Unit1;interfaceusesWindows, Messages,
SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;const
InputboxMessage = WM_USER + ...
分类:
其他好文 时间:
2014-05-12 19:20:32
阅读次数:
314