Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def re ans1 , ans2 , af, bf
- [*0..9].repeated_permutation(2).to_a.each do |x,y|
- if af[x,y] == ans1
- if bf[x,y] == ans2
- print "x=",x , "_y=" , y
- print "_af_" , af[x,y] , "_"
- print "_bf_" , bf[x,y] , "\n"
- return x,y
- end
- end
- end
- nil
- end
- ans1 = 3
- ans2 = 9
- af = ->x,y{ x + y } # x + y = 3
- bf = ->x,y{ (x*2) + (5*y)} # 2x + 5y = 9
- p re( ans1 , ans2 , af , bf)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement