Skip to content

Instantly share code, notes, and snippets.

@DickyT
Last active December 14, 2015 04:15
Show Gist options
  • Save DickyT/232162e3bce257490dc2 to your computer and use it in GitHub Desktop.
Save DickyT/232162e3bce257490dc2 to your computer and use it in GitHub Desktop.
Procedure ComputeProfit ( lott_database, ref_arr )
INPUT: lott_database, the array of all customer lottery arrays
ref_arr, the reference of current week lottery array
OUTPUT: profit, the profit of current week lottery
earn_count = len(lott_database) * 2
give_out_count = 0
for each_lott_arr in lott_database {
match_count = CountMatches(each_lott_arr, ref_arr)
if match_count == 6 && len(each_lott_arr) == 6:
give_out_count += 100000
if match_count == 5 && len(each_lott_arr) == 5:
give_out_count += 500
if match_count == 4 && len(each_lott_arr) == 4:
give_out_count += 10
if match_count == 3 && len(each_lott_arr) == 3:
give_out_count += 4
}
profit = earn_count - give_out_count
return profit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment