码迷,mamicode.com
首页 >  
搜索关键字:int    ( 143001个结果
字节顺序
#include typedef int* int_ptr; typedef unsigned char* byte_ptr; void show_bytes( byte_ptr start, int len ){ int i; for( i = 0; i < len; ++i ){ printf( " %4.2x", start[i] ); } printf( "\n"...
分类:其他好文   时间:2014-10-07 13:34:43    阅读次数:164
C#: 方法的默认参数
大家都知道在C++中,我们可以为方法的参数指定一个默认值,像这样:void foo(int i = 100);当我们以这种形式调用方法的时候: foo(); 实际上参数i被赋于了默认值,所以相当于调用了foo(100);然而在C#中是不支持参数的默认值的,那么如果我们要用到类似的功能应该怎么实现呢?...
分类:其他好文   时间:2014-10-07 11:44:23    阅读次数:213
类型转换
int main (int argc, char **argv) { unsigned int a = 0xFFFFFFF7; unsigned char i = (unsigned char)a; char* b = (char*)&a; printf("i = %08x\nb = %08x\n"...
分类:其他好文   时间:2014-10-07 11:07:23    阅读次数:149
foj 2082 树链剖分 第2天
擦,没啥好说的,这个模板至少得打10遍。。纪念自己成功的打错了。。 #include #include #include #include using namespace std; #define LL int #define lson id << 1 #define rson id << 1|1 const LL M = 100008; LL ti[M],top[M],siz[M],...
分类:其他好文   时间:2014-10-07 10:40:53    阅读次数:260
rand(5) -> rand(7)
int rand7() //random number from 1 - 7{ int r = 0; do { int a = rand(5) - 1; //uniformly at random from 0 to 4 int b = rand(5) - ...
分类:其他好文   时间:2014-10-07 08:16:23    阅读次数:226
神小逻辑 Remove Duplicates from Sorted Array
/*put all vaild new array from the 0 to new length*/public class Solution { public int removeDuplicates(int[] A) { if(A.length < 2) ...
分类:其他好文   时间:2014-10-07 06:55:53    阅读次数:120
Max Points on a Line
计算所有的slope 放到一个arraylist中. 特殊情况是the same as point . 遍历所有./** * Definition for a point. * struct Point { * int x; * int y; * Point() : x(0)...
分类:其他好文   时间:2014-10-07 05:19:42    阅读次数:284
基础 sorted array查找最多的一个值.
int pp = 1; //number of points in the same line of the point i if (k.size()==0){pp=0;} for (int jj=1;jjres){res=pp...
分类:其他好文   时间:2014-10-07 05:19:32    阅读次数:187
Java自学笔记(第四天)
(*)数组:同一种类型数据的集合。其实数组就是一个容器。 可以自动给数组中的元素从0开始编号,方便操作这些元素。//格式1:int[] arr = new int[3];//格式2:int[] arr = new int[]{1,2,3};//格式3:int[] arr = {1,2,3}...
分类:编程语言   时间:2014-10-07 01:06:32    阅读次数:286
快速排序
主要是是一个分治算法。 形象地看就是 挖坑+递归 1. A[p,r]分为A[p,q-1]和A[q+1,r]两部分,要求A[p,r]<q<A[q+1,r]. 2. 对A[p,r]和A[q+1,r]进行快速排序 #include<stdio.h> int?partition(int?a[],int?left,in...
分类:其他好文   时间:2014-10-07 00:58:03    阅读次数:203
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!