码迷,mamicode.com
首页 >  
搜索关键字:using    ( 53562个结果
剑指offer 面试题40—数组中两个只出现一次的数字
题目: 一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。要求时间复杂度O(n),空间复杂度O(1)。 基本思想: http://blog.csdn.net/wtyvhreal/article/details/44260321 #include using namespace std; int Find1(int n)//从低位开始找第...
分类:编程语言   时间:2015-05-03 09:20:34    阅读次数:139
二分查找的探讨
/* 二分查找 普通版 bs(); 求下界 low_bs(); 求上界 up_bs(); */ #include #include using namespace std; //[l,r) int bs(int *T,int l,int r,int v) { int m; while(l>1 要加括号 ...
分类:其他好文   时间:2015-05-03 00:51:19    阅读次数:201
次小生成树【模板】
给一个图,判断图的最小生成树是否唯一。 End[]记录邻接表尾节点的位置。MST表示最小生成树的大小,SecMST表示次小生成树的大小。#include #include #include #include using namespace std; const int MAXN = 1010; const int MAXM...
分类:其他好文   时间:2015-05-03 00:49:11    阅读次数:187
RMQ-ST算法
RMQ(Range Minimum/Maximum Query),即区间最值查询,是指这样一个问题:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j#include #include #include using namespace std;const int N = 10e6+1.....
分类:编程语言   时间:2015-05-03 00:45:00    阅读次数:183
杭电ACM1035——Robot Motion
这一题,简单的递归就可以搞定。 题目的意思是给出一个指令的二维数组,让一个机器人来走,第一种情况,可以走出去,算出多少步,第二种情况,一直无限走,存在一个环,算出环有几步,其他的有几步。 下面是AC的代码: #include #include using namespace std; bool vis[15][15]; /...
分类:其他好文   时间:2015-05-02 23:27:59    阅读次数:204
poj 1084 Square Destroyer dlx解重复覆盖
分析: 将问题转化为重复覆盖问题,DancingLink解决。 代码: //poj 1084 //sep9 #include using namespace std; const int maxN=10024; const int maxL=128; int L[maxN],R[maxN],U[maxN],D[maxN]; int C[maxN],H[maxN]; int S[maxN],...
分类:其他好文   时间:2015-05-02 23:26:48    阅读次数:194
Matrix.(POJ-2155)(树状数组)
一道二维树状数组的题目,比较经典,适合新手练习。 可以打印出来每次操作后矩阵的情况,就能很直观的理解这个树状数组是怎么实现的,他将多余的部分巧妙的重复了偶数次,使得多余部分奇偶不会发生变化。 #include #include #include #include #include #include #include using namespace std; int T,n,m,bit[1005...
分类:编程语言   时间:2015-05-02 23:26:30    阅读次数:155
HDU 5090 Game with Pearls
直接贪心就可以了,接收的时候把0都加上k,每次从最小的数开始找,如果有多个相同的,那么保留一个,其他的都加上k #include #include using namespace std; int a[105]; int main(){ #ifndef ONLINE_JUDGE freopen("in.txt","r",stdin); #endif int T,n,k; scanf("...
分类:其他好文   时间:2015-05-02 23:24:48    阅读次数:170
js生成二维码实例(真实有效)
js文件 qrcode.js 代码/*from tccdn minify at 2014-6-4 14:59:43,file:/cn/c/c/qrcode.js*//** * @fileoverview * - Using the 'QRCode for Javascript library' *....
分类:Web程序   时间:2015-05-02 23:21:57    阅读次数:286
11 URAL1025 Democracy in Danger
选择人数较少的m/2只队,每只队中半数人投票。 #include #include using namespace std; int main() { int i,n,ans,s[110]; while(~scanf("%d",&n)) { for(i=0;i<n;i++) scanf("%d",&s[i]); sort(s...
分类:其他好文   时间:2015-05-02 22:08:04    阅读次数:119
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!