题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation a ...
分类:
其他好文 时间:
2016-04-20 17:51:22
阅读次数:
115
leetcode上面的很简单的题目 Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given ...
分类:
编程语言 时间:
2016-04-18 22:17:31
阅读次数:
139
/* debug masks (32 bits, non-overlapping) */#define D_BUG 0x00000001#define D_INFO 0x00000002#define D_WARNING 0x00000004#define D_ERROR 0x00000008#de ...
分类:
其他好文 时间:
2016-04-18 19:03:03
阅读次数:
153
Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given num = 5, return f ...
分类:
其他好文 时间:
2016-04-18 13:29:50
阅读次数:
201
342. Power of Four Total Accepted: 707 Total Submissions: 2005 Difficulty: Easy Given an integer (signed 32 bits), write a function to check whether i ...
分类:
其他好文 时间:
2016-04-18 13:16:59
阅读次数:
156
最近准备刷 leetcode 做到了一个关于位运算的题记下方法 int cunt = 0; while(temp) { temp = temp&(temp - 1); //把二进制最左边那个1变为零 count++; //统计1的个数 } 同理把位二进制坐左边那个0变为1 就可以 temp = te ...
分类:
其他好文 时间:
2016-04-17 20:33:38
阅读次数:
116
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), retur ...
分类:
编程语言 时间:
2016-04-15 21:35:57
阅读次数:
196
别人跑几百毫秒 我跑 2500多 1 #include<cstdio> 2 #include<map> 3 //#include<bits/stdc++.h> 4 #include<vector> 5 #include<stack> 6 #include<iostream> 7 #include<a ...
分类:
其他好文 时间:
2016-04-15 21:30:46
阅读次数:
238
题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation a ...
分类:
其他好文 时间:
2016-04-14 20:57:58
阅读次数:
154
题目大意:n个点,求第k远的点对的距离 KD树裸题 注意要用堆维护第k远 #include<bits/stdc++.h> #define ll unsigned long long #define maxn 100010 using namespace std; inline int read(){ ...
分类:
其他好文 时间:
2016-04-12 12:58:25
阅读次数:
403