Created
July 30, 2016 23:49
-
-
Save harhogefoo/10470df9f6b20a52342ef546942c64ff to your computer and use it in GitHub Desktop.
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
require "date" | |
require 'benchmark' | |
result = Benchmark.realtime do | |
# 抽出対象の期間を設定 | |
term = Date.parse('19641010')..Date.parse('20200724') | |
# 数値化 | |
term_list = term.map { |d| d.strftime('%Y%m%d').to_i } | |
# 処理した結果が同じ値になるものを出力 | |
puts term_list.select { |d| d == d.to_s(2).reverse.to_i(2)} | |
end | |
puts "普通の答えの実行時間 : #{result}s" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment