Last active
September 23, 2021 03:52
-
-
Save lithtle/4a93d3ea2f5a8a6c7d6d6973113fa2dd to your computer and use it in GitHub Desktop.
目標ろんめんぺいになるまでどれだけCEを周回すればいいのか
This file contains hidden or 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
# deepcopyに必要なやつ | |
require 'active_support' | |
require 'active_support/core_ext' | |
# 目標ろんめんぺい金額 | |
START = 808888 | |
GOAL = 888888 | |
# 各種CEで取得可能な金額とラベル | |
PATTERN = { | |
CE1: 1700, | |
CE2: 2800, | |
CE3: 4100, | |
CE4: 5700, | |
CE5: 7500 | |
} | |
# カウンター足す | |
def create_result_hash(h, ce) | |
h[:counter][ce] += 1 | |
h | |
end | |
# 周回回数を調べる | |
def calc_money(start=0, goal=GOAL, sum=0, result) | |
# 目標金額を超えたら結果を表示して終了 | |
puts "--------------" if start + sum == goal | |
if start + sum >= goal | |
puts "金額: #{start + sum}, 差額:#{goal - (start + sum)}" | |
p result[:counter] | |
puts "--------------" if start + sum == goal | |
return | |
end | |
# 各CEごとに得られるろんめんぺいをどんどん追加していく | |
PATTERN.each { |k, v| | |
calc_money(start, goal, sum + v, create_result_hash(result.deep_dup, k)) | |
} | |
end | |
calc_money(START, GOAL, 0, {labels: [], counter: {CE1: 0, CE2: 0, CE3: 0, CE4: 0, CE5: 0}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ろんめんぺいあと80000稼げばなんかきれいになるじゃん?
こうするには
CE1=>43回, :CE2=>1回, :CE3=>1回 周回すればピッタリ80000ろんめんぺい稼げるらしい
理性が10*43+15+20=465必要ですね…
むりだよ…