码迷,mamicode.com
首页 >  
搜索关键字:bits    ( 3873个结果
【leetcode】Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit in...
分类:其他好文   时间:2015-04-05 23:20:17    阅读次数:177
拓扑排序欢乐多
拓扑排序 拓扑排序 一:使用DFS实现二:使用入度概念以及队列处理1.使用一般队列2.使用优先队列(这里定义越大的整数拥有越大的优先级) 一:使用DFS实现 #include bits/stdc++.h>using namespace std;#define maxn 10000 + 10int c[maxn],topo[ma...
分类:编程语言   时间:2015-04-05 17:33:41    阅读次数:132
C++头文件#include<bits/stdc++.h>
一句话的事,直截了当——#include包含C++的所有头文件参考网站(点击):http://www.tuicool.com/articles/m6neUj#include这个头文件包含以下等等C++中包含的所有头文件:#include #include #include #includ...
分类:编程语言   时间:2015-04-03 20:55:20    阅读次数:135
Reverse Bits
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:其他好文   时间:2015-04-03 19:11:16    阅读次数:86
数据结构之Floyd
窝觉得Floyd好简单,dikstra跟Floyd一样都是n3,还是觉得Floyd写起来简单hdu2544代码:#include "bits/stdc++.h"#define inf 0x3f3f3f3fint dis[110][110];int main(){ int i,j,k,t; int n...
分类:其他好文   时间:2015-04-03 13:09:40    阅读次数:108
Linux内核源代码情景分析-文件的打开
打开文件的系统调用是open(),在内核中通过sys_open()实现,假设filename是"/usr/local/hello.c",且假设这个文件已经存在,代码如下:asmlinkage long sys_open(const char * filename, int flags, int mode) { char * tmp; int fd, error; #if BITS_PER_L...
分类:系统相关   时间:2015-04-03 11:15:40    阅读次数:173
leetCode 190-Reverse Bits
链接: https://leetcode.com/problems/reverse-bits/ 此题的关键是预先将1 class Solution { public: Solution(){ unsigned int i = 0; unsigned int j = 1; for(; i < 32; i++) a[i] = (j<<(31-i)); } ...
分类:其他好文   时间:2015-04-01 20:01:40    阅读次数:126
leetCode191-Number of 1 Bits
链接:https://leetcode.com/problems/number-of-1-bits/ 此题关键是如何判断一个数字的第i为是否为0  即: x& (1 class Solution { public: int hammingWeight(uint32_t n) { int count = 0; for(int i = 0; i < 32; ...
分类:其他好文   时间:2015-04-01 20:01:26    阅读次数:122
LeetCode - Reverse Bits
二进制转换和字符串逆序。要考虑int的范围,测试数据是有溢出的。Math.pow是有精度损失的,最好写成整数的。public class ReverseBits { public static int reverseBits(int n) { StringBuilder...
分类:其他好文   时间:2015-04-01 01:40:34    阅读次数:122
LeetCode 191 Number of 1 Bits
题目描述: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit integer ’11' has binary representa...
分类:其他好文   时间:2015-03-30 18:42:17    阅读次数:128
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!