码迷,mamicode.com
首页 >  
搜索关键字:bits    ( 3873个结果
461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul ...
分类:其他好文   时间:2017-01-22 22:40:27    阅读次数:268
LightOJ-1005 组合数学,组合数水题
LightOJ 1005 题意:n*n的棋盘,放入k个车,要使k个车不相互攻击,有多少种方案。 总结:从n行选出k行(C(n,k)),再从n列选出k列(A(n,k)),即C(n,k)*A(n,k)。 注:纠结是C还是A,举个简单的例子,看交换后是否相同。 #include<bits/stdc++.h ...
分类:其他好文   时间:2017-01-21 13:07:27    阅读次数:167
LeetCode-461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul ...
分类:其他好文   时间:2017-01-20 10:58:16    阅读次数:142
洛谷P1428小鱼比可爱
#include<bits/stdc++.h>using namespace std;int a[101],b[101],n;int main(){ cin>>n; for (int i=1;i<=n;i++) cin>>a[i]; for (int i=1;i<=n;i++) for (int j ...
分类:其他好文   时间:2017-01-19 21:29:27    阅读次数:225
洛谷P1082同余方程
#include<bits/stdc++.h>using namespace std; int exGcd(int a,int b,int &x,int &y) { if(b==0) { x=1; y=0; return a; } int r=exGcd(b,a%b,x,y); int t=x; x ...
分类:其他好文   时间:2017-01-19 21:23:37    阅读次数:189
洛谷P1177快速排序
#include<bits/stdc++.h>using namespace std;const int maxx = 100000 + 10;int Heap[maxx];int main() { int n,num = 0,x; scanf("%d",&n); for(int i=1; i<=n ...
分类:编程语言   时间:2017-01-19 21:21:38    阅读次数:177
51nod四级题(第一波汇总)
1051 最大子矩阵和() 思路: 用前缀和维护成块 然后 和 最大子序列和 同理。前缀和这块 O(n²) 后面最大子序列和 O(n),O(n³)。 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 ...
分类:其他好文   时间:2017-01-19 01:22:11    阅读次数:281
338. 1的位数 Counting Bits
规律:i等于二的N次幂时,Hamming weight为 1.HammingWeight(2) = 1HammingWeight(3) = HammingWeight(2) + HammingWeight(1) = 2......HammingWeight(8) = 1HammingWeight(9... ...
分类:其他好文   时间:2017-01-16 22:30:36    阅读次数:198
LeetCode 476. Number Complement
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1: Exa ...
分类:其他好文   时间:2017-01-12 22:38:41    阅读次数:245
[LeetCode] Number Complement 补数
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given inte ...
分类:其他好文   时间:2017-01-12 13:04:36    阅读次数:239
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!