const关键字是C++中常用的类型修饰符,用法非常灵活,使用const将大大改善程序的健壮性。 const的作用 1. 定义const常量; 比如:
const int Max = 100; 2. 便于类型检查; const 常量有数据类型,而宏常量没有数据类型。 编译器对前者进行类型安全检查; ...
分类:
编程语言 时间:
2014-05-08 14:29:56
阅读次数:
351
CH1-2:概述 链接器:链接库代码、启动代码(start-up code)
CH3-5:数据、字符串、运算符 1 数据类型存储方式:整数类型、浮点数类型 2 浮点数存储:小数部分+指数部分 3 int: 3.1 %#o,%#x,%#X
分别是前缀0,0x,0X 3.2 (32位系统,括号中为64位...
分类:
其他好文 时间:
2014-05-08 12:01:59
阅读次数:
448
链接:http://poj.org/problem?id=1775
Description
John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of m...
分类:
其他好文 时间:
2014-05-07 23:57:32
阅读次数:
402
数学问题
题目详情:
给你两个长度为n的正整数序列分别为{a1,a2,a3...an},{b1,b2,b3...bn},0
设S=max{x1*a1+x2*a2+x3*a3+...+xn*an,(1-x1)*b1+(1-x2)*b2+(1-x3)*b3+...+(1-xn)*bn},xi为整数,0
请你求出S的最小值。
输入描述:
输入包含多组测试数据,以文件结...
分类:
其他好文 时间:
2014-05-07 21:32:14
阅读次数:
313
告诉你n种规模的长方体的长,宽,高,每种规模的长方体个数不限,问你最多能搭多高的塔,塔是由这些长方体搭的,自上而下,每一块长方体都要比在它下面的长方体的规模小,即长和宽都比下面的长方体要小。注意长方体是可以调整的。
我们用dp[i]来表示搭建到第i块长方体的时候塔的最高高度,那么状态转移方程就是dp[i]=max(dp[i],dp[j]+s[i].h);
#include
#include...
分类:
其他好文 时间:
2014-05-07 21:31:35
阅读次数:
291
Given n points on a 2D plane, find the maximum
number of points that lie on the same straight line. 解题想法:
其实判断一个直线上最好的方法是判断斜率。如果在同一直线上,那么直线上一点与其他点的斜率相...
分类:
其他好文 时间:
2014-05-07 21:13:02
阅读次数:
323
简单:e sum of the squares of the first ten natural
numbers is,12 + 22 + ... + 102 = 385The square of the sum of the first ten
natural numbers is,(1 + 2 ...
分类:
其他好文 时间:
2014-05-07 20:23:43
阅读次数:
338
题目链接 Find the contiguous subarray within an array
(containing at least one number) which has the largest sum. For example, given
the array [?2,1,?3,4,...
分类:
其他好文 时间:
2014-05-07 16:42:42
阅读次数:
287
std::string GetFilePath() { char
exepath[MAX_PATH];std::string strdir,tmpdir;memset(exepath,0,MAX_PATH);
GetModuleFileName(NULL,exepath,MAX_PATH); tmp...
分类:
其他好文 时间:
2014-05-07 14:59:14
阅读次数:
240
题目链接:1331 - Minimax Triangulation
题意:按顺序给定一些点,把这些点分割为n - 2个三角形,代价为最大三角形面积,求代价最小
思路:区间DP,dp[i][j]代表一个区间内,组成的情况,枚举k,dp[i][j] = min(max(dp[i][k],dp[k][j], area(i, j, k)),area代表i、j、k三点构成的三角形面积,然后判断该三角形内...
分类:
其他好文 时间:
2014-05-07 12:15:38
阅读次数:
367