现在位置: 首页 > marmot发表的所有文章
  • 11月
  • 10日
综合 ⁄ 共 690字 评论关闭
对翻过一次的排序数组二分查找,要利用好已排序这个条件 class Solution { public: int search(int A[], int n, int target) { int left = 0, right = n-1; while(left <= right){ int mid = (left+right)/2; if(A[mid] == target) return mid; if(A[left] <= A[mid]){ if(A[left] <= target && target < A[mid]) right = mid-1; else left = mid+1; ......
阅读全文
  • 07月
  • 17日
综合 ⁄ 共 9234字 评论关闭
5.11 hash_multimap        hash_multimap和hash_map的区别就像multimap与map的区别一样,hash_multimap的底层机制是基于hashtable,它可以存在重复的键值,所以插入函数使用insert_equal(),hash_multimap和hash_map一样,容器的内容不自动排序。本文源码出自SGI STL的<stl_hash_map.h>文件。 hash_multimap源码 // Forward declaration of equality operator; needed for friend declaration. //hash_multimap与hash_map的差别就是插入函数,前者的插入函数是采用底层机制hash table的insert_equal() //后者则采用insert......
阅读全文
  • 03月
  • 17日
综合 ⁄ 共 272字 评论关闭
在清理小时候的东西时,竟意外在一个抽屉底下发现了5张100的钞票,这不是我的小金库吗,实在是搞笑连我自己都不记得这边还有一个了。还好确认其归属非常简单,几张钞票都非常陈旧了,出厂时间都是1999年,这样子的话,无疑应该是属于我的,想想看,小时候的金库位置可真不少啊,尤其喜欢放在抽屉的底下或夹层里,结果往往到最后连自己都忘了,哈哈.... 当然这个小金库不是今天唯一的收获,看着这么多“人人头”,玻璃珠,“琵琶子枪”,BB弹枪,四驱车...唉,真是韶华易逝啊,当年还在考虑怎样把“琵琶子枪”做的强力一点,现在却已即将......
阅读全文
  • 12月
  • 28日
综合 ⁄ 共 885字 评论关闭
//求最长相同的串a后缀和串b的前缀(或者是最长相同的串b后缀和串a的前缀), //进行合并,得到长度最短的a+b,且字典序最小 //解题思路: //KMP的运用,利用KMP求出最长相同的串a后缀和串b的前缀 和 最长相同的串b后缀和串a的前缀, //然后按较长的进行输出 #include<stdio.h> #include<string.h> char s1[100002],s2[100002]; int next1[100002],next2[100002]; void get(int next[],char s[]) { int len=strlen(s); int j,i; j=-1;i=0;next[0]=-1; while(i!=len) { if(j==-1||s[i]......
阅读全文
  • 08月
  • 27日
综合 ⁄ 共 38字 评论关闭
Intent.FLAG_ACTIVITY_CLEAR_TASK  api 11+
阅读全文
 IOS7环境中,设置UITextView.text并不能立即更新contentSize,再用textView.contentSize.height无法获取当前内容的高度。采用以下方法可以解决这个问题。 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {                   CGRect textFrame=[[self.textView layoutManager]usedRectForTextContainer:[self.textView textContainer]];         height = textFrame.size.height;               }else {                   height = self.textView.contentSize.height;     }
阅读全文
  • 05月
  • 22日
综合 ⁄ 共 130字 评论关闭
.MMTab {table-layout: fixed;width: 100%;} .MMTab td {text-overflow: ellipsis;overflow: hidden;white-space: nowrap;padding: 0px;height: 25px;}
阅读全文
  • 05月
  • 18日
综合 ⁄ 共 5107字 评论关闭
转载自:http://www.bit-101.com/blog/?p=1824 For the final installment in this series, we’ll add accelerometer support to the ball, allowing you to tilt the device to change the direction of “down”. Note, although you can rotate the device in the iPhone simulator, this does not simulate acceleration. The only way you’ll be able to see this in action is on a physical device. This means that you’ll have to pay $99 sign up for and be accepted to the iPhone Developer program, and figure out......
阅读全文
  • 05月
  • 17日
综合 ⁄ 共 10697字 评论关闭
--************************************************************************************** --字符函数 --大小写转换函数 --LOWER (strexp) 返回字符串,并将所有的字符小写. --'SQL Course'转化为小写 select lower('SQL Course') from dual --UPPER (strexp) 返回字符串,并将所有的字符大写. --'SQL Course'转化为大写 select UPPER('SQL Course') from dual --函数在数据库中的应用 select empno,lower(ename) from emp --INITCAP(strexp) 将字符串的(每个单词的)第一个字母变为大写,后面的......
阅读全文
  • 05月
  • 08日
综合 ⁄ 共 3610字 评论关闭
这篇文章主要介绍如何利用Sysdeo Eclipse Tomcat Launcher plugin 编辑和调试JSP与Servlet 一. 需要的软件    Sysdeo Eclipse Tomcat Launcher plugin      主页      http://www.sysdeo.com/eclipse/tomcatPlugin.html     下载      http://www.sysdeo.com/eclipse/tomcatPluginV3.zip         这是一个eclipse插件,可以帮助编辑JSP文件。     安装插件,参考   《links安装Eclipse插件》二. 环境配置     为了编辑和调试JSP文件,环境配置有些麻烦,有几点要注意。1. 检查环境变量的设置。     右击“我的电脑”->高级->......
阅读全文
  • 04月
  • 25日
综合 ⁄ 共 817字 评论关闭
题目:http://pat.zju.edu.cn/contests/pat-a-practise/1032 题解: 给两个字符串的链表存储,如果两个字符有相同的后缀,其后缀会存放在相同内存块,问这两个字符串是否有相同的后缀,如果有相同的后缀求出最开始相同的字母的内存地址。 先遍历一个字符串,标记出现过哪些地址,再遍历另一个字符串,出现相同地址的即所求解。 注:竟然卡STL C中格式字符串的一般形式为: %[标志][输出最小宽度][.精度][长度]类型, 其中方括号[]中的项为可选项。 代码: #include<cstdio> #include<cstring> #include<cmath> ......
阅读全文
  • 04月
  • 13日
综合 ⁄ 共 69字 评论关闭
淡定淡定~~   不管别人坐了多么让你火的事情,都请保持淡定。   快速的把自己分内的工作做好,不要去抱怨不要去评论,留出时间做自己想做的,OK~
阅读全文