首页 > 2014年06月02日 > 全部分享
【剑指offer】约瑟夫环问题
题目描述: 每年六一儿童节,JOBDU都会准备一些小礼物去看望孤儿院的小朋友,今年亦是如此。HF作为JOBDU的资深元老,自然也准备了一些小游戏。其中,有个游戏是这样的:首先,让小朋友们围成一个大圈。然后,他随机指定一个数m,让编号为1的小朋友开始报数。每次喊到m的那个小朋友要出列唱首歌,然后可以在礼品箱中任意的挑选礼物,并且不再回到圈中,从他的下一个小朋友开始,继续1...m报数....这样下去....直到剩下最后一个小朋友,可以不用表演,并且拿到JOBDU名贵的“名侦探柯南”典藏版(名额有限哦!!^_^...
分类:其他   时间:2014-06-02 11:02:01    收藏:0  评论:0  赞:0  阅读:405
【剑指offer】无聊的1+2+...+n
题目描述: 求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 输入: 输入可能包含多个测试样例。 对于每个测试案例,输入为一个整数n(1<= n<=100000)。 输出: 对应每个测试案例, 输出1+2+3+…+n的值。 样例输入:...
分类:其他   时间:2014-06-02 10:37:20    收藏:0  评论:0  赞:0  阅读:565
【剑指offer】不用加减乘除做加法
题目描述: 写一个函数,求两个整数之和,要求在函数体内不得使用+、-、*、/四则运算符号。 输入: 输入可能包含多个测试样例。 对于每个测试案例,输入为两个整数m和n(1<=m,n<=1000000)。 输出: 对应每个测试案例,输出m+n的值。...
分类:其他   时间:2014-06-02 11:01:25    收藏:0  评论:0  赞:0  阅读:427
【剑指offer】字符串转整数
关于这道题目,题目本身还是不错的,真正核心的代码也就那么两行,大部分代码基本都在做非法输入的检查。 最近做这几道题目,对九度后台的测试用例有点无语了,这道题目的测试用例应该有问题,我写的代码自己测试了很多种不同的非法输入以及合法输入,都没问题,但是在九度OJ上只有第四条测试用例通过,其他四条全部WA,害的我搞了一个晚上,后来下了个别人AC的代码,拿来测试了下,结果各种非法的输入都没处理,很多非法的输入,得到的都是些莫名奇妙的答案。 先贴上代码,大家帮我看下有木有没考虑到的地方:...
分类:其他   时间:2014-06-02 10:36:36    收藏:0  评论:0  赞:0  阅读:396
java swing实现的多线程实例代码教程-赛马demo
java swing实现的多线程实例代码教程-赛马demo http://www.zuidaima.com/share/1825492473826304.htm...
分类:编程语言   时间:2014-06-02 11:00:46    收藏:0  评论:0  赞:0  阅读:631
背包与构造
题目:给定一个数,,求它最少可以用多少个包含字符串"61"的数字来表示,并输出这些数。   分析:对于大于6161的任何一个整数,都有如下表示               对于小于1616的数,直接背包即可。   代码: #include #include #include using namespace std; typedef long long LL; const...
分类:其他   时间:2014-06-02 10:35:56    收藏:0  评论:0  赞:0  阅读:273
深入理解 JBoss 7/WildFly Domain 模式启动过程
概述JBoss 7/WildFly 以 domain 模式启动时会启动多个 JVM,例如如下通过启动脚本启动 domain 模式:./domain.sh启动后我们查看进程:[kylin@localhost tdump]$ jps -l 23655 /home/kylin/work/eap/jboss-eap-6.1/jboss-modules.jar 23671 /home/kylin/work/...
分类:其他   时间:2014-06-02 10:32:05    收藏:0  评论:0  赞:0  阅读:458
HDU1505(HDU1506的加强版)
昨天打 CF又跪了,最近睡不好睡不好睡不好~感觉整个人都累傻了,根本无办法写下去,仅仅写了一题签到题就跪了orz..从未试过这么悲剧。 今天早上凭着我的意念(“怨念”),七点又起来了!我已经连续好多天七点自动起来(不是自然醒,是意念,是意念....),刷啊刷啊刷dp. 今天刷的是昨天的加强版,实际上就多了一个for循环,和做高度处理,不直到是不是正解(  ╮(╯▽╰)╭ ),但是AC就好了.....
分类:其他   时间:2014-06-02 11:00:09    收藏:0  评论:0  赞:0  阅读:439
获取当前日期
这里要用到date函数的第三种形式,下面是获得当前日期(set 'today (date (date-value) 0 "%Y%m%d")) (date-value) 返回的是1970年0点累计的秒数,作为date函数的地一个参数第二个参数是偏移的分钟,0表示没有偏移,就是现在。 这个参数主要用来做时区转换第三个参数定义日期格式,参考下表:formatdescription%aabbreviate...
分类:其他   时间:2014-06-02 10:57:19    收藏:0  评论:0  赞:0  阅读:339
分支-12. 计算火车运行时间(15)
本题要求根据火车的出发时间和达到时间,编写程序计算整个旅途所用的时间。 输入格式: 输入在一行中给出2个4位正整数,其间以空格分隔,分别表示火车的出发时间和到达时间。每个时间的格式为2位小时数(00-23)和2位分钟数(00-59),假设出发和到达在同一天内。 输出格式: 在一行输出该旅途所用的时间,格式为“hh:mm”,其中hh为2位小时数、mm为2位分钟数。 输入样例...
分类:其他   时间:2014-06-02 10:59:29    收藏:0  评论:0  赞:0  阅读:1341
大话计算机中的流水作业
在学习计算机组成原理中的指令系统的时候,我们会遇到一个非常经典的技术流水作业。人们一般称这是一种技术,其实我更喜欢把它称为一种思想,它就是我们生活中工厂里流水作业思想在计算机中的运用。...
分类:其他   时间:2014-06-02 10:30:54    收藏:0  评论:0  赞:0  阅读:484
LeetCode: Interleaving String [097]
【题目】 Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca", When s3 = "aadbbcbcac", return true. When s3 = "aadbbbaccc", return false. 【题意】 给定字符串s1,s2,s3, 判断s3是不是s1和s2中的字交叉组合...
分类:其他   时间:2014-06-02 10:58:44    收藏:0  评论:0  赞:0  阅读:238
LeetCode: Validate Binary Search Tree [098]
【题目】 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with ke...
分类:其他   时间:2014-06-02 10:30:17    收藏:0  评论:0  赞:0  阅读:320
leetcode-Subsets
Subsets  Total Accepted: 13267 Total Submissions: 48509My Submissions Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be in non-desc...
分类:其他   时间:2014-06-02 10:28:56    收藏:0  评论:0  赞:0  阅读:366
LeetCode: Recover Binary Search Tree [099]
【题目】 Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n) space is pretty straight forward. Could you devise a constant space solution? confused what "{1,#,2,3}" ...
分类:其他   时间:2014-06-02 10:38:38    收藏:0  评论:0  赞:0  阅读:312
LeetCode: Same Tree [100]
【题目】 Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 【题意】 判断了两个二叉树是否相等 【思路】 递归...
分类:其他   时间:2014-06-02 11:03:25    收藏:0  评论:0  赞:0  阅读:296
LeetCode: Symmetric Tree [101]
【题目】 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / 2 2 / \ / 3 4 4 3 But the following is not: 1 / 2 2 \ 3 3 No...
分类:其他   时间:2014-06-02 10:56:34    收藏:0  评论:0  赞:0  阅读:270
OpenGL【2 坐标变换】
// OpenGL.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include using namespace std; void init(void) { glClearColor(1.0,1.0,1.0,1.0); glClear(GL_COLOR_BUFFER_BIT); glShadeMod...
分类:其他   时间:2014-06-02 11:02:39    收藏:0  评论:0  赞:0  阅读:355
[Oracle] Insert All的妙用
无条件的插入 Oracle中的insert all是指把同一批数据插入到不同的表中,假如现在有个需求:把t表中的数据分别插入t1,t2,如果你不知道insert all,你可能会使用insert插入2次,如下所示: insert into t1(object_name,object_id) select * from t; insert into t2(object_name,object...
分类:数据库技术   时间:2014-06-02 10:33:22    收藏:0  评论:0  赞:0  阅读:328
1+2+3+...+n不能用while、for、if else等实现
问题描述 求 1+2+ … +n ,要求不能使用乘除法、 for 、 while 、 if 、 else 、 switch 、 case 等关键字以及条件判断语句。 实际意义不大,题目涉及的知识还是不错的! 方法1 用构造函数求解。 #include using namespace std; class Plus { public: Plu...
分类:其他   时间:2014-06-02 10:29:39    收藏:0  评论:0  赞:0  阅读:337
1249条   上一页 1 ... 12 13 14 15 16 ... 63 下一页
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!