码迷,mamicode.com
首页 >  
搜索关键字:sizeof    ( 5917个结果
最长递增子序列-动态规划(引用编程之美)
测试用例:输入:1,-1,2,-3,4,-5,6,-7输出:4 1 int lis(int array[]){ 2 int n=sizeof(array); 3 //定义lisMax存放当前的最长递增序列 4 int nMax=1; 5 //list[i]中放着从ar...
分类:其他好文   时间:2014-09-15 22:32:29    阅读次数:302
9.9 链表及其运用
单向链表的实现方法:#include #include struct list{ int data; struct list *next;};/*创建一个节点*/struct list *create_list(){ return calloc(sizeof(struct list) , 1);}/...
分类:其他好文   时间:2014-09-15 01:02:28    阅读次数:277
C语言--指针问题_1
#include #include main(){ int *a,*b,*c; a=b=c=(int *)malloc(sizeof(int)); *a=1; *b=2; *c=3; a=b; printf("%d %d %d\n",*a,*b,*c);}你...
分类:编程语言   时间:2014-09-15 00:58:37    阅读次数:192
BOOL、sizeof
BOOL使用前需要声明#include(这个头文件定义了bool,true,false等宏)int a[5];sizeof(a[5]),sizeof是关键字,求值是在编译时,sizeof(a[5])并不会报错,这个值并不存在,但是这里并没有真正去访问a[5]这个值,而是仅仅根据数组元素的类型来确定其...
分类:其他好文   时间:2014-09-14 23:20:37    阅读次数:314
POJ 2183
模拟题#include #include #include using namespace std;int p[1000000];int main(){ int n; while(scanf("%d",&n)!=EOF){ memset(p,0,sizeof(p)); int i; for(i...
分类:其他好文   时间:2014-09-14 23:19:48    阅读次数:373
HDU5012 Dice 记忆化搜索
写错了,坑了自己好久,直接广搜可能更好,我害怕超时,记忆化搜索了一下 ,写的时候小地方写错了, int dp[7][7][7][7][7][7]; int su,sd,sl,sr,sf,sb; int eu,ed,el,er,ef,eb; void init() { memset(dp,-1,sizeof(dp)); } bool input() { while(ci...
分类:其他好文   时间:2014-09-14 18:02:37    阅读次数:266
韩信点兵
#include #include int main(){ int *a,*b,*c; int num; int i; scanf("%d",&num); a = (int *)malloc((num+1) * sizeof(int)); b = (int *)m...
分类:其他好文   时间:2014-09-12 01:13:12    阅读次数:218
二进制输入或文件的读取
fread(*p,sizeof(datatype),number,FILE *file); 说明:p是所要接收的类型变量,datatype是基本类型,number是要读取多少个,*file是文件名,或者指从哪里读取。 *file可以是文件名或者标准输入输出。 fwrite类似。 例如:UVALive 6426 int main() { int s[105][105]; ...
分类:其他好文   时间:2014-09-11 20:59:02    阅读次数:197
[C++]Reference to array as function parameter
templatevoid f(char (&arr)[N]){ std::cout << sizeof(arr) << '\n';}此时数组不会退化为指针(C++11 section 8.3.5.5)
分类:编程语言   时间:2014-09-11 16:40:42    阅读次数:224
数码视讯2015校招笔试 C++ 简单总结
> 两题都是看代码,然后找出代码中的错误,并作出解释。 ## 题目一 int array[] = {1,2,3,4,5,6}; #define elements (sizeof(array)/sizeof(array[0])) int main() { int d = -1, x; for(int i = d; i< elements-...
分类:编程语言   时间:2014-09-11 15:35:12    阅读次数:176
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!