码迷,mamicode.com
首页 >  
搜索关键字:int    ( 143001个结果
linux驱动之 信号量 自旋锁 互斥体
原子操作 原子操作就是单位操作,也就是说操作过程不能被中断 下面代码中每条语句看起来是原子操作,其实不是原子操作; int main(0 { int i=2;//两天汇编语句组成 i=i+3;//三条汇编语句组成 } 实现原子操作方法; 1  自旋锁    自旋锁它是为为实现保护共享资源而提出一种锁机制。其实,自旋锁与互斥锁比较类似 ,它们都是为了解决对某项资源的互斥...
分类:系统相关   时间:2015-05-28 10:53:52    阅读次数:269
php 判断数组中是否有重复的值
$input = array(4, "4", "3", 4, 3, "3"); $result = array_unique($input); *//**array(2) { [0] => int(4) [2] => string(1) "3" }**/
分类:编程语言   时间:2015-05-28 10:51:48    阅读次数:151
poj1274 匈牙利算法 二分图最大匹配
poj1274题意: 有n个奶牛, m个畜舍, 每个畜舍最多装1头牛,每只奶牛只有在自己喜欢的畜舍里才能产奶。 求最大产奶量。 分析: 其实题意很明显, 二分图的最大匹配, 匈牙利算法。 #include #include #include #include using namespace std;int n, m, sum,...
分类:编程语言   时间:2015-05-28 09:40:27    阅读次数:150
POJ - 3233 Matrix Power Series 矩阵快速幂
题目大意:Given a n × n matrix A and a positive integer k, find the sum S = A + A^2 + A^3 + … + A^k.解题思路:将矩阵分块就可以解决了, 其中的S表示的是前n项的和,An指的是A^n, E指单位阵,O指零矩阵#include typedef long long ll; const int N =...
分类:其他好文   时间:2015-05-28 09:29:50    阅读次数:161
45 Jump Game ii
DPpublic class Solution { public int jump(int[] A) { if (A == null || A.length == 0) { return 0; } int reac...
分类:其他好文   时间:2015-05-28 09:21:48    阅读次数:124
55 Jump Game
public class Solution { public boolean canJump(int[] nums) { if (nums == null || nums.length == 0) { return false; } ...
分类:其他好文   时间:2015-05-28 09:16:50    阅读次数:118
LeetCode【3】.Longest Substring Without Repeating Characters--算法图解及java实现
第三道题Longest Substring Without Repeating Characters如下:      public class Solution { public int lengthOfLongestSubstring(String s) { HashMap hs = new HashMap(); int maxl = 0;...
分类:编程语言   时间:2015-05-28 08:15:38    阅读次数:264
ARM上函数调用参数超过四个的时传递方法
众所周知,ARM架构下,函数参数是通过 r0~r4寄存器传递的;但是如果参数超过四个,就要借助于栈了。 下面以一个例子说明。 int func(int a1, int a2, int a3, int a4, int a5, int a6) { return a1 + a2 + a3 + a4 + a5; } int main(void) { func(1, 2, 3, 4, 5, 6);...
分类:其他好文   时间:2015-05-28 08:13:35    阅读次数:207
Minimum Size Subarray Sum
暂时理解不了二分那个算法O(n)public class Solution { public int minSubArrayLen(int s, int[] nums) { // http://bookshadow.com/weblog/2015/05/12/leetcode-m...
分类:其他好文   时间:2015-05-28 07:05:14    阅读次数:89
204 Count Primes
class Solution {public: int countPrimes(int n) { int count=0; vectormap(n+1,true); for(int i=2;i<n;i++){ if(map[i])...
分类:其他好文   时间:2015-05-28 07:03:35    阅读次数:164
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!