We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
猴版
写个函数,给定一个字符串列表之后按下面格式打印出来,一行一个打印在矩形框中。 例如,列表["Hello", "World", "in", "a", "frame"]打印的结果是:
["Hello", "World", "in", "a", "frame"]
********* * Hello * * World * * in * * a * * frame * *********
虎版
******* *faiWH* *r noe* *a rl* *m ll* *e do* *******
龙版
好不威风 脚 拳 踢 打 西 南 湖 山 托 敬 儿 老 所 院
自虐版 使用VIM等文本编辑器实现
VIM
The text was updated successfully, but these errors were encountered:
#encoding: utf-8 # 虎版 MAX_LENGTH = 5 input = ["hello", "world", "in", "a", "frame"] input.map! {|x| x + " "* (MAX_LENGTH - x.size)} input.map! {|x| "*" + x + "*"} input = ["*" * (MAX_LENGTH + 2) ] + input + ["*" * (MAX_LENGTH + 2) ] input.map! {|x| x.split("")} input = input.transpose input.each do |x| puts x.join.reverse! end # 龙版 a = " 拳打南山敬老院" c4 = "好 " c3 = "不 " c2 = "威 " c1 = "风 " b = " 脚踢西湖托儿所" input = [a, c1, c2, c3, c4, b] input.map! {|x| x.split("")} input = input.transpose input.each do |x| puts x.join.reverse! end
Sorry, something went wrong.
#encoding: utf-8 puts "猴版" strs = ["Hello", "World", "in", "a", "frame"] strs = ["Merry ", "Christmas", "for", "Everyone"] strs = ["Wish ", "BlackQA", "Happy", "New", "Year"] max = 0 strs.each do |str| if max < str.size max = str.size end end puts ('*')*(max+4) strs.each do |str| print ('* ') print str print (' ')*(max - str.size) puts (' *') end puts ('*')*(max+4)
#encoding: utf-8 puts "虎版" strs = ["Hello", "World", "in", "a", "frame"] strs = ["Merry ", "Christmas", "for", "Black"] strs = ["Wish ", "BlackQA", "Happy", "New", "Year"] col = strs.size max = 0 strs.each do |str| if max < str.size max = str.size end end puts ('*')*(col+4) for i in 0..max-1 do print('* ') for str in strs.reverse do print(str[i] || ' ') end puts(' *') end puts ('*')*(col+4)
#encoding: utf-8 puts "龙版" strs = ["好不威风", "脚踢西湖托儿所", "拳打南山敬老虎"] strs = ["黑手党", "天王盖地虎", "宝塔镇河妖"] col = strs[0].size row = strs[1].size puts(" #{strs[0]} ") for i in 0.. row-1 do print("#{strs[1][i]}") print(' '*(col*2)) print("#{strs[2][i]}") puts end
No branches or pull requests
猴版
写个函数,给定一个字符串列表之后按下面格式打印出来,一行一个打印在矩形框中。
例如,列表
["Hello", "World", "in", "a", "frame"]
打印的结果是:虎版
龙版
自虐版
使用
VIM
等文本编辑器实现The text was updated successfully, but these errors were encountered: