Last active
May 17, 2019 02:24
-
-
Save tompng/07c8e8b8f04626d104fff1c33bb7a094 to your computer and use it in GitHub Desktop.
puzzle for okinawarb 201905 "HelloWorld" を出力するように、何文字か(なるべく少ない文字数)追加してください
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = %w(Goodbye World Hello) | |
t = %w(Hello World Goodbye) | |
tap { | |
$> << s[-1] # Hello | |
} | |
tap { | |
$> << t[-1] # Goodbye | |
.to_str | |
} | |
tap { | |
$>.<<(t[s.size - 2 % 4]) # World | |
} | |
tap { | |
$>.<<(s[t.size - 3 % 5]) # Goodbye | |
.to_io | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = %w(Hello Goodbye World) | |
3.times do |i| | |
print s[(i-2).abs-1] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defined? $><<'World'<<($><<'Hello')<<'GoodBye' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
send def say | |
$> << 'Goodbye' << ($> << 'Hello' << 'World'; 'World') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
解答 https://gist.github.com/tompng/1270002185556ff1cfedd64278c56ea2