Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A s...
分类:
其他好文 时间:
2014-06-28 09:55:50
阅读次数:
205
经常使用cd命令切换目录,虽有cd-,历史目录poppush等操作,终究不直观。直接上代码及部署:
i=1
HERE=`pwd`
VALID_HERE=${HERE//\//\\\/}
ALREADY_EXIST=`grep^${HERE}$$1`
declare-agodirs
whiletrue;do
[[$2="a"]]&&[[x${ALREADY_EXIST}="x"]]&&sed-i"/^EOF/..
分类:
系统相关 时间:
2014-06-28 06:50:25
阅读次数:
338
要求:批量创建10个系统账号oldboy01-oldboy10,并设置生成密码(密码不同).实现脚本:#!/bin/bash
#Question3
foriin$(seq-w10)
do
useradd-s/bin/basholdboy$i
echo"password$i"|md5sum|tee-apasswd.txt|passwd--stdinoldboy$i
done脚本执行效果:[root@localhostq4]#shq4.sh
Cha..
分类:
其他好文 时间:
2014-06-28 06:21:21
阅读次数:
340
遍历目录中所有文件,并且统计文件类型。#!/bin/bash
#filename:filestat.sh
#set-x
if[$#-ne1];
then
echo$0basepath;
echo
fi
path=$1
declare-Astatarray;
whilereadline;
do
ftype=`file-b"$line"`
letstatarray["$ftype"]++;
done<<(find$path-typef-print)
ech..
分类:
其他好文 时间:
2014-06-28 00:16:08
阅读次数:
224
This question is not so difficult.
First,my thoughts were we should use a lot of code to find out the loop block,but there is no need to do that .
you just need to get every new position of char in ...
分类:
其他好文 时间:
2014-06-27 23:39:44
阅读次数:
293
Determine whether an integer is a palindrome. Do this without extra space.
分类:
其他好文 时间:
2014-06-27 12:28:06
阅读次数:
228
过滤器
它是在java web中,你传入的request,response提前过滤掉一些信息,或者提前设置一些参数,然后再传入servlet或者struts的 action进行业务逻辑,比如过滤掉非法url(不是login.do的地址请求,如果用户没有登陆都过滤掉),或者在传入servlet或者 struts的action前统一设置字符集,或者去除掉一些非法字符
拦截器
它是在面...
分类:
编程语言 时间:
2014-06-27 10:48:09
阅读次数:
320
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5300
大致题意:给出一个无向图,以及起点与终点。要删除一些边使得起点与终点不连通,在删掉边的权值之和最小的情况下要求删除的边数尽量少。求出一个比值:剩余边数权值和/删除的边数。
思路:删除边的权值之和最小显然是求最小割即最大流。但同时要求删除边数最少,解决方...
分类:
其他好文 时间:
2014-06-27 08:08:26
阅读次数:
177
使用通配符,只不过命名的时候*的位置跟{1}保持一致.
我写的这个action继承dispatchAction,parameter=method
假如里面有add方法和edit方法()
访问add方法的时候,使用这个地址:/addPerson.do?method=add-->这个时候input就是/add.jsp
访问edit方法的时候,使用这个:/editPerson.do?...
分类:
其他好文 时间:
2014-06-27 07:21:52
阅读次数:
202