码迷,mamicode.com
首页 >  
搜索关键字:const 常量    ( 36792个结果
【COGS1384】鱼儿仪仗队
【题目描述】Jzyz的池塘里有很多条鱼,鱼儿们现在决定组成一个仪仗队。现在备选的N(1 2 #include 3 #include 4 #include 5 #include 6 const int maxn=100010; 7 using namespace std; 8 long lo...
分类:其他好文   时间:2014-05-23 04:41:27    阅读次数:186
hdu 4824 Disk Schedule(双调欧几里得旅行商问题)
题目链接:hdu 4824 Disk Schedule 题目大意:中文题。 解题思路:需要的时,很明显每到一层是要读取一次数据的,但是因为需要返回00,所以有些层的数据可以在返回的过程中读取会较优。于是转化成了双调欧几里得旅行商问题。 #include #include #include #include using namespace std; const int N =...
分类:其他好文   时间:2014-05-23 00:00:02    阅读次数:382
hdu 4826 Labyrinth(dp)
题目链接:hdu 4826 Labyrinth 题目大意:中文题。 解题思路:不难想的递推,dp[i][j][0]从上面过来的情况,dp[i][j][1]从下面过来的情况,然后这两种情况都可以从前一列走过来。 #include #include #include using namespace std; const int N = 105; const int INF = 0...
分类:其他好文   时间:2014-05-22 22:42:28    阅读次数:350
提高编程效率的C++编程箴言
对于单纯常量,最好以const对象或enums替换#defines对于形似函数的宏,最好改用inline函数替换#define将某些东西声明为const可帮助编译器侦测出错误用法。const可被施加于任何作用域内的对象、函数参数、函数返回类型、成员函数本体。当const和non-const成员函数有着实质等价的实现时,令non-const版本调用const版本可避免代码重复。确定对象被使用前已经被...
分类:编程语言   时间:2014-05-22 17:09:29    阅读次数:263
用javap命令反编译来分析字符串问题
编写Test.java,编译完后生成Test.class文件,然后对该文件执行javap -c Test命令,生成字节码指令,阅读并得出结论 一、s1和s2指向常量池的不同常量 ①java代码 public class Test {     public static void main(String[] args) throws IOException {         ...
分类:编程语言   时间:2014-05-22 17:02:59    阅读次数:434
C++宽窄字符串转换
首先,贴出我给出的解决方案:http://files.cnblogs.com/xuejianhui/utils.rar再则,贴出网上最常见的例子:#include std::string ws2s(const std::wstring& ws){ std::string curLocale =...
分类:编程语言   时间:2014-05-21 18:46:28    阅读次数:400
poj1195 mobile phones 【二维树状数组】
一次AC 二维树状数组,有模版很好办 注意二维树状数组这个下标是[1][1]的 #include #include #include #include #include #include using namespace std; const int Max = 1030; int row, col, ar[Max][Max]; // 二维的其实下标为[1][1],这个要记得。 ...
分类:其他好文   时间:2014-05-21 16:23:34    阅读次数:271
POJ1182 食物链 【并查集变种】
挺简单的 N个元素扩展为 3*N个 i-A i-B i-C A吃B吃C吃A 挑战程序设计的89面 #include #include #include #include #include using namespace std; int N,K; const int MAX_N=333333; //并查集 int par[MAX_N]; int rank[MAX_N];//树的...
分类:其他好文   时间:2014-05-21 16:03:48    阅读次数:216
令人纠结的两行代码
以下内容系原创,转载请务必注明地址 主要参考资料:我在 Stackoverflow 上提的问题 Why the first is right but the second is wrong ? 这令人纠结的两行代码如下: const char *cval = "nothing"; // 正确 int *ival = {1, 2, 3, 4}; // 错误...
分类:其他好文   时间:2014-05-21 15:32:47    阅读次数:277
C++ Primer 学习笔记_82_模板与泛型编程 --类模板成员[续2]
模板与泛型编程--类模板成员[续2]六、完整的Queue类Queue的完整定义:template class Queue; template ostream &operator &); template class QueueItem { friend class Queue; friend ostream & operator(ostream &,const Q...
分类:编程语言   时间:2014-05-21 14:07:20    阅读次数:304
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!