摘要: "553. Optimal Division" 题目大意:a/b/c/d...,在上面式子中加括号使得值最大 解题思路: 无论怎么加括号,a肯定是分子,b肯定是分母,要使值最大,分子a是定的,那么应该让分母最小,由于a,b...均是正整数,所以应该让b一直除,所以应当把括号加在a/(b/c/d... 阅读全文
posted @ 2018-08-21 21:37 默写年华 阅读(79) 评论(0) 推荐(0) 编辑
摘要: "原题: 343. Integer Break" 题目大意:给你一个数(2 57), 将这个数拆成若干项(和不变),使其乘积最大。 解题思路: 我们知道,一个数,无论拆成多少项,当每一项都相等时,其乘积最大;假设我们将N拆成N/x个x,于是其乘积就是 x^(N/x),我们对这个乘积求导: 可知,当x 阅读全文
posted @ 2018-08-21 21:37 默写年华 阅读(115) 评论(0) 推荐(0) 编辑
摘要: "413. Arithmetic Slices" 题目大意:找出数组中存在多少等差序列(该序列在原数组是连续的) 解题思路: 1,2,3 → 存在一个即1,2,3 1,2,3,4 →存在3个,即1,2,3;1,2,3,4; 2,3,4;在原来1,2,3的基础上多了2个 1,2,3,4,5 → 存在6 阅读全文
posted @ 2018-08-21 21:35 默写年华 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 原题: "672. Bulb Switcher II" There is a room with n lights which are turned on initially and 4 buttons on the wall. After performing exactly m unknown 阅读全文
posted @ 2018-08-21 21:34 默写年华 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目大意 "Bulb Switcher" There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third rou 阅读全文
posted @ 2018-08-21 21:32 默写年华 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 原题: "728.Self Dividing Numbers" A self dividing number is a number that is divisible by every digit it contains. For example, 128 is a self dividing n 阅读全文
posted @ 2018-08-21 21:31 默写年华 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 原题: "640.Solve the Equation" Solve a given equation and return the value of x in the form of string "x= value". The equation contains only '+', ' ' op 阅读全文
posted @ 2018-08-21 21:27 默写年华 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 原题: "670.Maximum Swap" Given a non negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum value 阅读全文
posted @ 2018-08-21 21:27 默写年华 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 原题: "29. Divide Two Integers" Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 题目大意:不用乘 阅读全文
posted @ 2018-08-21 21:24 默写年华 阅读(142) 评论(0) 推荐(0) 编辑
摘要: "原题462. Minimum Moves to Equal Array Elements II" 题目大意: 给你一串数字,对于每个数字,一次性可以移动一步(数值增加1或者减小1),请问如何在最小的步伐数内使所有的数字都相等 Example Input: [1,2,3] Output: 2 Exp 阅读全文
posted @ 2018-08-21 21:21 默写年华 阅读(102) 评论(0) 推荐(0) 编辑
摘要: "原题:781. Rabbits in Forest" 题目大意: 森林里每只兔子报告说有多少只兔子和它的颜色一样,求森林里最少有几只兔子? 解题思路: 首先确定有多少只兔子的说法相同,假设有 a[i] 只兔子都说和它颜色相同的兔子有 i 只,那么要分析 a[i] 与 i 的关系。比如说,3只兔子说 阅读全文
posted @ 2018-08-21 21:20 默写年华 阅读(172) 评论(0) 推荐(0) 编辑
摘要: "原题:592. Fraction Addition and Subtraction" 题目大意: 给出一个分数字符串式子(分子分母都是1~10),求其和 解题思路: 利用 ,它可以自动地实现字符串和数字之间的转换,比如 1/2,可以输出为 1,/,2,把每个数取出来后就通分进行计算 代码: 以上 阅读全文
posted @ 2018-08-21 21:19 默写年华 阅读(99) 评论(0) 推荐(0) 编辑
摘要: "原题:858. Mirror Reflection" There is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are receptor 阅读全文
posted @ 2018-08-21 21:16 默写年华 阅读(377) 评论(0) 推荐(0) 编辑
摘要: "原题:869. Reordered Power of 2" Starting with a positive integer N, we reorder the digits in any order (including the original order) such that the lea 阅读全文
posted @ 2018-08-21 21:13 默写年华 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 1. \ 一级标题 \ 二级标题 \ 三级标题 2. 引用 > +空格 + 引用内容” 3. 粗体 \ \ 文字 4. 斜体 \ 文字 5. 段首空格 推荐全角空格,切换到全角模式下(一般的中文输入法都是按 shift + space)输入两个空格就行了。这个相对 来说稍微干净一点,而且宽度是 阅读全文
posted @ 2018-08-21 21:03 默写年华 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1. 游标移动 在普通模式下,使用方向键或 `l j` `w b`可以移动游标 |按键|说明 |: :|: : |h|左 |l|右(小写L) |j|下 |k|上 |w|下一个单词 |b|上一个单词 2. 进入插入模式 |命令|说明 |: :|: : |i|在当前光标前插入 |I|大写I,在行首插入 阅读全文
posted @ 2018-08-21 21:02 默写年华 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 1. Hello World Linux 系统根据 " !" 及该字串后面的信息确定该文件的类型,可以通过 man magic命令 及 /usr/share/magic 文件来了解这方面的更多内容。 在 BASH 中 第一行的 " !" 及后面的 /bin/bash 就表明该文件是一个 BASH 程 阅读全文
posted @ 2018-08-21 21:02 默写年华 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 1. 2. 输入以下代码,在文件位置需要修改 3. 保存后退出,即可在搜索得到: 阅读全文
posted @ 2018-08-21 21:02 默写年华 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 一、环境变量 1. 读取变量的值,使用 和`$ $`用于表示引用一个变量的值) 2. |命 令| 说 明 |: :|: : |set| 显示当前 Shell 所有变量,包括其内建环境变量(与 Shell 外观等相关),用户自定义变量及导出的环境变量。 |env| 显示与当前用户相关的环境变量,还可以 阅读全文
posted @ 2018-08-21 21:01 默写年华 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 1. 快捷键 |按键|作用 |: :|: : |Ctrl + d|键盘输入结束或退出终端 |Ctrl + s|暂停当前程序,暂停后按下任意键恢复运行 |Ctrl + z|将当前程序放到后台运行,恢复到前台的命令为 |Ctrl + a|将光标移到行头,相当于home键 |Ctrl + e|将光标移到行 阅读全文
posted @ 2018-08-21 20:57 默写年华 阅读(162) 评论(0) 推荐(0) 编辑