码迷,mamicode.com
首页 >  
搜索关键字:bits    ( 3873个结果
UVa 12545 Bits Equalizer (贪心)
题意:给出两个等长的字符串,0可以变成1,?可以变成0和1,可以任意交换s中任意两个字符的位置,问从s变成t至少需要多少次操作。 析:先说我的思路,我看到这应该是贪心,首先,如果先判断s能不能变成t,就计算t中的1和s中的1。 然后算出t比s多多少1,然后先考虑把?变成1是最优的,如果不够就只能把0 ...
分类:其他好文   时间:2016-06-06 06:48:34    阅读次数:155
Leetcode 338 – Counting Bits
解法三种: Sln 1. 笨办法,移位。时间复杂度太高,基本就是O(n * sizesof(int)).Sln 2. 利用一个小技巧,偶数除二,在其另外一个乘数左移 1bit而得;奇数在前所得上加1Sln 3. Hamming Weight; 利弊: Sln 1不考虑,复杂度过高。相对来说Sln 2 ...
分类:其他好文   时间:2016-06-05 15:20:44    阅读次数:290
【bzoj3527】[Zjoi2014]力 FFT
2016-06-01 21:36:44 题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3527 我就是一个大傻叉 微笑脸 1 #include<bits/stdc++.h> 2 #define inf 1000000000 3 #define ...
分类:其他好文   时间:2016-06-01 22:56:02    阅读次数:368
【bzoj3160】万径人踪灭 FFT
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3160 我是一个傻叉 微笑脸 1 #include<bits/stdc++.h> 2 #define inf 1000000000 3 #define ll long long 4 #define ...
分类:其他好文   时间:2016-06-01 22:47:25    阅读次数:273
LeetCode 第 342 题(Power of Four)
LeetCode 第 342 题(Power of Four) Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, retu ...
分类:其他好文   时间:2016-06-01 21:04:56    阅读次数:153
cogs_14_搭配飞行员_(二分图匹配+最大流,网络流24题#01)
描述 http://cojs.tk/cogs/problem/problem.php?pid=14 有一些正飞行员和副飞行员,给出每个正飞行员可以和哪些副飞行员一起飞.一架飞机上必须一正一副,求最多多少飞机可以飞. 分析 裸的二分图匹配... 请叫我水题小王子... 1 #include <bits ...
分类:其他好文   时间:2016-06-01 19:43:43    阅读次数:156
【bzoj1367】[Baltic2004]sequence
2016-05-31 17:31:26 1 #include<bits/stdc++.h> 2 #define inf 1000000000 3 #define ll long long 4 #define N 1000005 5 using namespace std; 6 int read(){ ...
分类:其他好文   时间:2016-05-31 18:58:13    阅读次数:181
【Leetcode】Counting Bits
题目链接:https://leetcode.com/problems/counting-bits/ 题目: 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 representa...
分类:其他好文   时间:2016-05-30 15:35:05    阅读次数:174
【bzoj2049】[Sdoi2008]Cave 洞穴勘测 link-cut-tree
2016-05-30 11:04:51 学习了link-cut-tree 二中神犇封禹的讲义感觉讲的超级清晰易懂啊(没有的可以q窝 算是模板吧 #include<bits/stdc++.h> #define N 10005 #define inf 1000000000 #define ll long ...
分类:其他好文   时间:2016-05-30 12:55:16    阅读次数:230
百度之星复赛Astar Round3
拍照 树状数组。求出静止状态下,每个点能看到多少个向右开的船c1[i],多少个向左开的船c2[i]。 max{c1[i], max{ c2[j], (i <= j) } }即为答案。 注意要离散化,否则会Tle。 1 #include <bits/stdc++.h> 2 typedef long l ...
分类:其他好文   时间:2016-05-29 18:12:45    阅读次数:195
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!