码迷,mamicode.com
首页 >  
搜索关键字:bits    ( 3873个结果
素数环(dfs+回溯)
题目描述: 输入正整数n,把整数1,2...n组成一个环,使得相邻两个数和为素数。输出时从整数1开始逆时针排列并且不能重复; 例样输入: 6 例样输出: 1 4 3 2 5 6 1 6 5 2 3 4 方法1:(生成测试法,会超时) #include <bits/stdc++.h>#define M ...
分类:其他好文   时间:2016-09-07 21:08:35    阅读次数:169
八皇后(dfs+回溯)
重看了一下刘汝佳的白板书,上次写八皇后时并不是很懂,再写一次: 方法1:逐行放置皇后,然后递归; 代码: #include <bits/stdc++.h>#define MAXN 8#define ll long longusing namespace std;ll ans=0;int c[MAXN ...
分类:其他好文   时间:2016-09-07 19:19:00    阅读次数:127
Topcoder 144-150(未完待续)
SRM 144 Div2 1100 PowerOutage 题意:给定一个有根树,求遍历完整棵树的最小路程 题解:DFS一下,求出叶子节点中到根节点的最远距离,然后把树的所有边相加,乘以二,减去最远距离就是答案 #line 2 "PowerOutage.cpp" #include<bits/stdc ...
分类:其他好文   时间:2016-09-07 01:35:37    阅读次数:149
ubuntu系统 编译libxml2的库是遇到如下错误
大家好:我买了细说PHP书来学习。在搭建环境时使用的是ubuntu系统编译libxml2的库是遇到如下错误,Infunction‘open‘,inlinedfrom‘xmlNanoHTTPSave__internal_alias‘atnanohttp.c:1588:12:/usr/include/x86_64-linux-gnu/bits/fcntl2.h:51:24:error:callto‘__open_missing_mode‘..
分类:系统相关   时间:2016-09-06 23:49:00    阅读次数:205
HC - 05 bluetooth module settings in Linux using CuteCom
By default the bluetooth module HC-05 sets baud rate at 38400, data bits 8, Stop bits 1 All schematics of this bluetooth module can be found at : http ...
分类:系统相关   时间:2016-09-05 19:02:15    阅读次数:321
子集生成
输入n,由n得到集合D{1~n},输出集合D的所有子集; 方法1:增量构造法(依次往集合中增加一个元素) 代码: #include <bits/stdc++.h>#define ll long long#define MAXN 100+10using namespace std;int a[MAXN ...
分类:其他好文   时间:2016-09-04 11:39:51    阅读次数:137
LintCode刷题笔记--Flip Bits
Flip Bits: 标签:位运算 题目:Determine the number of bits required to flip if you want to convert integer n to integer m. 解题思路: 给出两个数字a和b,返回两个数字中需要转换的内容这道题主要是 ...
分类:其他好文   时间:2016-09-02 11:34:08    阅读次数:122
leetCode 338. Counting Bits | Dynamic Programming | Medium
338.CountingBitsGivenanonnegativeintegernumbernum.Foreverynumbersiintherange0≤i≤numcalculatethenumberof1‘sintheirbinaryrepresentationandreturnthemasanarray.Example:Fornum=5youshouldreturn[0,1,1,2,1,2].题目大意:给一个数字,比如5,那么5之前所有的整数的每个..
分类:其他好文   时间:2016-09-02 01:02:18    阅读次数:113
全排列(next_permutation)
next_permutation函数既可用于非重排列也可用于重排列; #include <bits/stdc++.h>#define MAXN 200000+10#define ll long longusing namespace std;int a[MAXN];int main(void){ i ...
分类:其他好文   时间:2016-09-01 23:01:34    阅读次数:129
链表的可变参数构造与图的临接表实现   广度有限遍历
#include<bits/stdc++.h> usingnamespacestd; typedefstructnode { intx; node*next; node(){next=NULL;} }node; typedefstructhead { intx; intcount; node*head; //head(intxx,intcc,node*P=NULL){x=xx;count=cc;head=p;} }head; voidInsertTail(node*head,intval) {..
分类:其他好文   时间:2016-09-01 16:39:18    阅读次数:200
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!