码迷,mamicode.com
首页 >  
搜索关键字:cas array    ( 36241个结果
Leetcode Merge Sorted Array
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal...
分类:其他好文   时间:2014-06-25 23:01:44    阅读次数:227
HAOI2011 problem b
其实就是容斥原理了代码: 1 uses math; 2 const maxn=55000; 3 var i,n,a,b,c,d,w,tot:longint; 4 ans:int64; 5 sum,mu,p:array[0..maxn] of int64; 6 procedure ge...
分类:其他好文   时间:2014-06-25 22:10:01    阅读次数:299
php插入排序
//php版插入排序$arr=array('','5','3','7','6','4','8','2'); for($i=2;$i<count($arr);$i++) { if($arr[$i]<$arr[$i-1]) { $arr[0]=$arr[$i]; for($j=$i-1;...
分类:Web程序   时间:2014-06-25 22:00:53    阅读次数:244
LeetCode——Single Number
Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using e...
分类:其他好文   时间:2014-06-24 23:30:08    阅读次数:278
POJ_1195 Mobile phones 【二维树状数组】
题目链接:http://poj.org/problem?id=1195 纯纯的二维树状数组,不解释,只需要注意一点,由于题目中的数组从0开始计算,所以维护的时候需要加1。因为树状数组的下标是不能为1的 代码: #include #include #define N 1030 using namespace std; int c[N][N]; int cas,n,x,y,a,l,b,r,t...
分类:其他好文   时间:2014-06-24 21:15:14    阅读次数:154
php冒泡排序
//冒泡排序 $arr=array('5','3','7','6','4','8','2','1'); $n=count($arr); for($i=0;$i$arr[$j+1]) { $t=$arr[$j]; $arr[$j]=$arr[$j+1]; $arr[$j+1...
分类:Web程序   时间:2014-06-24 14:27:10    阅读次数:175
折半排序 (稳定的排序)
$arr=array('','7','9','11','2','5','13','10','14','12'); $n=count($arr); for($i=2;$i$arr[0]) $high=$m-1; else $low=$m+1; } for($j=$i-1;...
分类:其他好文   时间:2014-06-24 14:09:04    阅读次数:223
php折半查找(数组必须为有序)
$arr=array('1','7','9','11','20','23','33','44','50'); $len=count($arr); $low=0;$high=$len-1; while($low'; if($arr[$mid]>9) { $high=$mid-1; ...
分类:Web程序   时间:2014-06-24 14:08:25    阅读次数:223
laravel 数据库操作小例子
public function demo() { $res = null; //insert数据插入 //$user=array('username'=>'joy','password'=>'123456','age'=>23); //$res = DB::table('users')->i...
分类:数据库   时间:2014-06-24 12:38:08    阅读次数:9946
PHP生成唯一订单号
<?php function build_order_no(){ return date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8); ...
分类:Web程序   时间:2014-06-24 11:59:06    阅读次数:345
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!