真是没见识,前些天才知道这首歌,好像02年就有了。
作者好像是青年小伙子,两个人的组合,他们的主页应该是http://www.youthnb.com/
这个是小河的版本。在原来的基础上更加有趣了。
歌词:
在一个漆黑的夜晚, 我和你背着降落伞
腰间的小刀一直闪, 再闪
就要去第一关, KAKA
为保卫祖国的安全, 为保卫人类的家园
为夺回列宁的遗产, 遗产
我们跟丫作战, KAKA
火箭筒有三发炮弹, 见到了梯子最危险
捡来的手枪有时间, 时间最后像狗一样, 过关
(为祖国健康工作五十年,我们是绿色兵团)
题目:有一根27厘米的细木杆,在第3厘米、7厘米、11厘米、17厘米、23厘米这五个位置上各有一只蚂蚁。木杆很细,不能同时通过一只蚂蚁。开始时,蚂蚁的头朝左还是朝右是任意的,它们只会朝前走或调头,但不会后退。当任意两只蚂蚁碰头时,两只蚂蚁会同时调头朝反方向走。假设蚂蚁们每秒钟可以走一厘米的距离。编写程序,求所有蚂蚁都离开木杆的最小时间和最大时间。
用Ruby来解,不知道结果对不对。
#define the Ant class
class Ant
attr_accessor : direction ,: pos ,: id
def veer # turn back when run into other ants
@direction = 1 - @direction
end
def arrived ?
return true if @pos == 0 or @pos == 27
return false
end
def step
if @direction == 1 then
@pos = @pos + 1
else
@pos = @pos - 1
end
end
def run_into ( a ) # if run into other ant,return true if so
return false if a . direction == self . direction
return true if a . pos == self . pos
return false
end
def to_s
" id:#{@id}.direction:#{@direction}.pos:#{@pos} "
end
end # end of Ant
class Hash
def keys
a = Array . new
self . each_key do | k |
a . push k
end
a
end
end
#initialize the ant[5] array
def create_ant ( d1 , d2 , d3 , d4 , d5 )
a1 , a2 , a3 , a4 , a5 = nil , nil , nil , nil , nil
( 1..5 ) . each do | i |
eval " a#{i} = Ant.new;a#{i}.id = #{i};a#{i}.direction = d#{i}; "
end
a1 . pos = 3
a2 . pos = 7
a3 . pos = 11
a4 . pos = 17
a5 . pos = 23
return [ a1 , a2 , a3 , a4 , a5 ]
end
#if all ant has arrived ,return true
def all_arrived a
a . each do | a1 |
return false unless a1 . arrived ?
end
return true
end
# get one plan's cost
# p is for puts the ant's progress if it is set to true
def travel ( d1 , d2 , d3 , d4 , d5 , p = false )
c = 0 #total cost
x = 0 #loop variables
onway = create_ant ( d1 , d2 , d3 , d4 , d5 )
while true
break if all_arrived ( onway )
x = 0
while ( x < onway . length - 1 ) do
( x = x + 1 ; next ) if onway [ x ] . arrived ?
if onway [ x ] . run_into onway [ x + 1 ] then
onway [ x ] . veer
onway [ x + 1 ] . veer
x = x + 2
else
x = x + 1
end
end
onway . each do | ai |
ai . step unless ai . arrived ?
end
c = c + 1
print " step#{format( " % 2 d " ,c)} : #{format( " %- 2 d " ,onway[0].pos)},#{format( " %- 2 d " ,onway[1].pos)}, " if p
print " #{format( " %- 2 d " ,onway[2].pos)},#{format( " %- 2 d " ,onway[3].pos)},#{format( " %- 2 d " ,onway[4].pos)} \n " if p
end
c
end
#path = {path length=><Array of direction info>}
path = Hash . new
[ 1 , 0 ] . each do | d1 |
[ 1 , 0 ] . each do | d2 |
[ 1 , 0 ] . each do | d3 |
[ 1 , 0 ] . each do | d4 |
[ 1 , 0 ] . each do | d5 |
cost = travel ( d1 , d2 , d3 , d4 , d5 )
( path [ cost ] ||= Array . new ) . push binding
end
end
end
end
end
puts " short path length : #{path.keys.sort.first},path count :#{path[path.keys.sort.first].length} "
path [ path . keys . sort . first ] . each_with_index do | b , i |
puts " short path #{format( " % 2 d " ,i+1)}: "
eval " print ' direction : ',d1,' ',d2,' ',d3,' ',d4,' ',d5, \"\n\" " , b
#eval "travel(d1,d2,d3,d4,d5,true)", b
end
puts " long path length : #{path.keys.sort.last},path count :#{path[path.keys.sort.last].length} "
path [ path . keys . sort . last ] . each_with_index do | b , i |
puts " long path #{format( " % 2 d " ,i+1)}: "
eval " print ' direction : ',d1,' ',d2,' ',d3,' ',d4,' ',d5, \"\n\" " , b
#eval "travel(d1,d2,d3,d4,d5,true)", b
end
Sql/mp是hp的NSK系统上的数据库,应该是老版本的了,新的叫SQL/MX。
SQL/mp里为什么要弄这么多的数值型的数据类型:NUMERIC,SMALLINT,INTEGER,LARGEINT,FLOAT,REAL,DOUBLE PRECISION,DECIMAL等。
而且这些类型好像还都能用在DDL语句里,而有些又是互相重合的,真的有点混。
今天主要看了一下NUMERIC和DECIMAL这两个类型。
这两个光看字面很难区分,numeric就是数字的意思,decimal是十进制的意思,不像int和float那样有没有小数点那么区别明显。
其实这两个类型的区别应该是在内部存贮上:
Numeric就是binary的,也就是内部形式。比如1,会存为0×0001
Decimal是基于ascii的,比如1会存为0×0031
(more…)
刚才在水母上看到的。
前不久好像马季刚走,个人喜欢超过侯宝林的大师。
侯耀文虽然不如他老爸,但是也是很喜欢的。
可惜。
个人不是很喜欢郭德纲,不知道今后的相声会如何。
去年就应该去了,这么好的人没拿到过欧冠。
虽然不能保证巴萨明年还能拿到欧冠。
希望亨利走好,毕竟年纪这么大了。
今天看Ruby Cookbook发现了这里面对binding的解释是目前看到的比较通俗易懂的了。
A Binding object is a bookmark of the Ruby interpreter’s state. It tracks the values of any local variables you have defined, whether you are inside a class or method definition, and so on.
Once you have a Binding object, you can pass it into eval to run code in the same context as when you created the Binding. All the local variables you had back then will be available. If you called Kernel#binding within a class definition, you’ll also be able to define new methods of that class, and set class and instance variables.
binding方法会返回一个Binding对象的实例,它记载了创建它的时候的环境,比如当时的变量等。然后你可以把这个binding变量传给方法等,它经常作为eval的第二个参数,这样eval里面就不会因为找不到变量出错了。
(more…)
今天看了他的的一段视频,至少是不喜欢他模仿万晓利。
status是显示进程信息,类似ps,status *,user表示显示所有当前用户的进程
status *,term表示由当前term启动的进程。
stop则是停止一进程,类似kill
还有一个命令就是run,用来启动一个程序,而且能启动时候会给进程付与一个名字,比如下面的$y4s5。
$VOL2 LIU 58> status *,user
Process Pri PFR %WT Userid Program file Hometerm
$Y4RZ 0,241 150 R 000 96,5 $SYSTEM.SYS04.TACL $ZTN00.#PT7BE
U0
$Y4S5 0,547 149 015 96,5 $SYSTEM.SYS04.EMSDIST $ZTN00.#PT7BE
TS
$VOL2 LIU 59> stop $y4s5
$VOL2 LIU 60> status *,term
Process Pri PFR %WT Userid Program file Hometerm
$Y4RZ 0,241 150 R 000 96,5 $SYSTEM.SYS04.TACL $ZTN00.#PT7BE
您好!
我了一技,致了某些已停的 AdWords
告系列容网中得展示次。此确您的已受到影。致了您的某些已停的告系列容网展示生次和
用。
我的工程已解此,您受到影的告系列已恢复正常。我向您的放了97.37 CNY
的信用,以您停的告系列生的用行。要在 AdWords 中查看信用,按以下步操作:
1. 通 https://adwords.google.com 登 AdWords 。
2. “我的”。
3. “算首”。
4. 您的信用示在算摘要中的整列收支下。
如果您有其他,支持中心,网址
https://adwords.google.com/support&hl=zh_CN,中可以找到多常的解答。
由此可能您的任何不便,我深表歉意。感您的理解。我的工程正努力找此的根源,并且采取相措施确保以后不再生似
情。
衷心感!
Google AdWords 小敬上
原文http://www.newsmth.net/bbstcon.php?board=ITExpress&gid=304665
今晨,西甲,皇家马德里第30次夺冠。
巴萨不该怪别人,只能明年再来了,亨利会来吗?
国米今年的冠军实在吗?希望明年再来证明。
曼联还是不错的,一直比较喜欢。不过明年如何看英超呢?
还有我仁,明年连欧冠都不能参加,马凯也要被卖了,克洛泽能来吗?
不过好像下个月开始就是亚洲杯了,可惜,这个节骨眼,看还是不看,怎么看?
两个人的100%。
我50%,她50%。