码迷,mamicode.com
首页 >  
搜索关键字:const    ( 26295个结果
20140606
1、求一串字符串中连续出现次数最多的字串 #include#include#includeusing namespace std;pair fun(const string &str){ vector substrs; int maxcount=1,count=1; string substr; i...
分类:其他好文   时间:2014-06-10 00:18:57    阅读次数:266
3D Transformation 3D物体位移函数
如何操作物体在3D空间中的位置呢,方法有很多。 这里总结一下最流行的矩阵操作。 1. 放大缩小一个物体,我们可以填写一个放大缩小矩阵,如下代码: void InitScaleTransform(Matrix4f& m) const { m.m[0][0] = m_scale.x; m.m[0][1] = 0.0f ; m.m[0][2] = 0.0f ; m.m[0]...
分类:其他好文   时间:2014-06-08 16:50:46    阅读次数:265
转换MFC CString 到std::string
std::string CStringToSTDStr(const CString& theCStr) { // Convert the CString to a regular char array const int theCStrLen = theCStr.GetLength(); char *buffer = (char*)malloc(sizeof(char)*(theCStrLe...
分类:其他好文   时间:2014-06-08 16:33:53    阅读次数:218
HDU 1754 I hate it 分段树Segment Tree题解
给出一段数据,然后要更新单个数据,会询问一段数据中的最大值。 又是一道分段树操作。渐渐熟手了。 #pragma once #include #include using namespace std; class IHateIt_1754_1 { static const int SIZE = 200001; int *segTree; //不要使用segTree[SIZE<<2]...
分类:其他好文   时间:2014-06-08 15:40:21    阅读次数:208
Light OJ 1278 Sum of Consecutive Integers N拆分成连续整数和
题目来源:Light OJ 1278 Sum of Consecutive Integers 题意:N拆分成连续整数和的方案数 思路:奇因数的个数 #include #include #include #include using namespace std; //筛素数 const int maxn = 10000010; bool vis[maxn]; int prime[10...
分类:其他好文   时间:2014-06-08 15:34:09    阅读次数:295
2-SAT模版
const int maxn = 100010; int n, m; vector G[maxn*2]; bool mark[maxn*2]; int S[maxn*2], c; int a[maxn], b[maxn], sum; bool dfs(int x) { if(mark[x^1]) return false; if(mark[x]) return true; mark...
分类:其他好文   时间:2014-06-08 10:31:01    阅读次数:198
POJ - 1324 Holedox Moving
题意:贪吃蛇的题目 思路:BFS+状态的记录,坑了无数发,#include #include #include using namespace std; const int MAXN = 500000; bool flag[8],vis[25][25],mp[21][21][16384]; int n,m,l; int xx[4]={-1,0,1,0}; // up,right,dow,left...
分类:其他好文   时间:2014-06-08 10:13:19    阅读次数:204
Light OJ 1251 Forming the Council 2-SAT输出任意一组解
题目来源:Light OJ 1251 Forming the Council 题意:若干了条件至少满足一个 求是否有方案 输出任意一种可能的方案 留下的人的个数 思路:2-SAT基础题 #include #include #include using namespace std; const int maxn = 100010; int n, m; vector G[maxn*2];...
分类:其他好文   时间:2014-06-08 08:15:18    阅读次数:261
freopen内部实现
1 #include 2 #include 3 4 FILE* Freopen(const char *fileName, const char *type, FILE *stream){ 5 FILE *fileFp = fopen(fileName, type); 6 int f...
分类:其他好文   时间:2014-06-08 06:39:51    阅读次数:247
ip白名单 通过* ? 检测IP匹配 轻量级
#include "stdafx.h"#include #include #include const int maxCount = 100;const int strMaxLen = 16; BOOLEAN IsMatchPattern(const char* ipPattern,const .....
分类:其他好文   时间:2014-06-08 01:33:47    阅读次数:219
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!