题目
Given an integer n, return 1 - n in lexicographical order.
For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9].
Please optimize your algorithm to use less time and space. The ...
分类:
其他好文 时间:
2016-08-23 22:07:24
阅读次数:
121
问题描述:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2. The number of element ...
分类:
编程语言 时间:
2016-08-23 21:55:27
阅读次数:
235
java.lang.OutOfMemoryError: Java heap space原因:Heap内存溢出,意味着Young和Old generation的内存不够。解决:调整java启动参数 -Xms -Xmx 来增加Heap内存。 java.lang.OutOfMemoryError: una ...
分类:
编程语言 时间:
2016-08-23 21:55:19
阅读次数:
156
<style type="text/css"> p{ width: 250px; color: red; overflow: hidden; text-overflow: ellipsis; word-break: break-all; white-space: nowrap; } p a{ col ...
分类:
其他好文 时间:
2016-08-23 18:43:50
阅读次数:
117
题目:Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, y ...
分类:
其他好文 时间:
2016-08-23 16:49:01
阅读次数:
125
在脚本中使用sed时,如果一行的内容较长,为了脚本美观要换行,在行尾添加“\”即可。注意:如果在“\”之后添加空格,例如:sed-i"/^xxx=/s/.*/xxx=$xxx/"\[:space:]$xxxecho$?[:space:]表示行尾有一个空格脚本会报如下错误:sed:-irequiresanargument./xxx.sh:line20:xxx.sh:..
分类:
其他好文 时间:
2016-08-22 23:53:06
阅读次数:
982
题目地址:http://acm.timus.ru/problem.aspx?space=1&num=2070
思路:质数一定满足题意(满足条件一,因子数为2为质数)。所以只需求出l到r中的合数且因子数为质数的数的个数。该数质因子只能为1(若大于一,则因子数为合数),所以枚举每个质数,若该质数的指数+1(因子数)为质数,则ans--。
#include
#include
#include
#in...
分类:
其他好文 时间:
2016-08-22 21:52:08
阅读次数:
207
题目地址:http://acm.timus.ru/problem.aspx?space=1&num=2068
思路:x个石子,x=2*k+1。分三堆2*k+1=(2*k1+1)+(2*k2+1)+(2*k3+1)=2(k1+k2+k3+1)+1。k1+k2+k3+1=k,每分一次,k1+k2+k3减少1,所以石子最多分k次。求出总次数,判断奇偶即可。
#include
#include
#in...
分类:
其他好文 时间:
2016-08-22 20:12:08
阅读次数:
190
题目地址:http://acm.timus.ru/problem.aspx?space=1&num=2069
思路:对于起点要么横着走,要么竖着走,则共有四种方式,直接竖横、横竖、先横后竖再横、现竖后横再竖,对于中间路径取最大值即可。
#include
#include
#include
#include
using namespace std;
const int maxn=1e5+50;
...
分类:
其他好文 时间:
2016-08-22 20:11:29
阅读次数:
172
1:在终端中运行cd命令,提示: e: Write error - write (28 No space left on device) E: Cant mmap an empty file 2:使用 df -h 查看磁盘空间情况: /dev/xvda1 20G 20G 0G 100% / 3:继续 ...
分类:
其他好文 时间:
2016-08-22 12:02:12
阅读次数:
615