码迷,mamicode.com
首页 >  
搜索关键字:const 底层const 顶层const    ( 26295个结果
IOS学习笔记---C语言第四天
1 //?生成2个数组,每个数组都有10个元素,元素取值范围20-40之间,数组对应元素相 加,放到另外?一个数组中 2 #import 3 4 int main(int argc, const char * argv[]) 5 { 6 7 int num1[10]={0},...
分类:移动开发   时间:2014-06-13 06:53:27    阅读次数:245
counting sort 计数排序
//counting sort 计数排序//参考算法导论8.2节#include#include#include#includeusing namespace std;const int k=5;const int n=7;int a[n]={5, 5, 1, 2 , 5, 4, 1};int b[...
分类:其他好文   时间:2014-06-12 23:08:11    阅读次数:237
poj2395 Out of Hay , 求MST的最长边
点击打开链接 求MST的最长边~ prim #include #include #include #include #define Min(a,b) (a)<(b)?(a):(b) using namespace std; const int INF = 1000000000; const int maxn = 2000 + 5; struct pto {...
分类:其他好文   时间:2014-06-11 06:45:17    阅读次数:235
uva Children's Game
非常巧妙的题目,巧用cmp,注意cmp的重载 #include #include using namespace std; string a[55]; bool cmp(string a, string b){ return a+b > b+a; } int main(int argc, char const *argv[]) { int n; while(cin >...
分类:其他好文   时间:2014-06-11 06:10:28    阅读次数:293
从Java到C++——常量(const)的高级应用
看到const关键字,C++程序员首先想到的可能是const常量。这可不是良好的条件反射。如果只知道用const定义常量,那么相当于把火药仅用于制作鞭炮。const更大的魅力是它可以修饰函数的参数、返回值,甚至函数的定义体。const是constant的缩写,“恒定不变”的意思。被const修饰的东西都受到强制保护,可以预防意外的变动,能提高程序的健壮性和高效性。所以很多C++程序设计书籍建议:“...
分类:编程语言   时间:2014-06-11 06:00:43    阅读次数:331
字符串查找匹配
vector split(const string& src, const string& separator){vectordest;string str = src;string substring;string::size_type start = 0, index;do{index = st...
分类:其他好文   时间:2014-06-10 20:35:36    阅读次数:238
Light 1289 LCM from 1 to n 素数筛选位优化
题目来源:Light 1289 LCM from 1 to n 题意:。。 思路:从1到n 打过某个数是以一个素数的几次方 那么答案就乘以这个素数 主要是筛选素数 存不下 位优化 一个整数32位标记32个数 内存缩小32倍 是学习别人的 #include #include #include #include using namespace std; const int maxn ...
分类:其他好文   时间:2014-06-10 18:05:45    阅读次数:250
Effective C++:条款12:复制对象时勿忘其每一个成分
(一) 一个继承体系的声明: class Date {...}; class Customer { public: ... private: string name; Date lastTransaction; }; class PriorityCustomer : public Customer { public: PriorityCustomer(const...
分类:编程语言   时间:2014-06-10 17:45:35    阅读次数:289
c语言结构体&常指针和常量指针的区别
结构体: 关系密切但数据类型不尽相同,常指针和常量指针的区别:char * const cp : 定义一个指向字符的指针常数,即const指针,常指针。const char* p : 定义一个指向字符常数的指针,即常量指针。char const* p : 等同于const char* p[2]。理解...
分类:编程语言   时间:2014-06-10 11:34:12    阅读次数:235
POJ - 1376 Robot
题意:求在可以一秒沿着既定方向走1到3步和向左或右转90度的情况下,从起点到终点的最短时间 思路:坑的是这机器人还有体积,所以不能走到边界,然后就是单纯的BFS #include #include #include #include #include using namespace std; const int MAXN = 110; struct node { int x,y;...
分类:其他好文   时间:2014-06-10 07:59:51    阅读次数:256
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!