Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1.  
  2. def re ans1 , ans2 , af, bf
  3. [*0..9].repeated_permutation(2).to_a.each do |x,y|
  4. if af[x,y] == ans1
  5. if bf[x,y] == ans2
  6. print "x=",x , "_y=" , y
  7. print "_af_" , af[x,y] , "_"
  8. print "_bf_" , bf[x,y] , "\n"
  9. return x,y
  10. end
  11. end
  12. end
  13. nil
  14. end
  15.  
  16. ans1 = 3
  17. ans2 = 9
  18. af = ->x,y{ x + y } # x + y = 3
  19. bf = ->x,y{ (x*2) + (5*y)} # 2x + 5y = 9
  20.  
  21. p re( ans1 , ans2 , af , bf)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement