Skip to content

Instantly share code, notes, and snippets.

@sorah
Last active August 19, 2022 04:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorah/b4fb491fa7c5e7d2a89d to your computer and use it in GitHub Desktop.
Save sorah/b4fb491fa7c5e7d2a89d to your computer and use it in GitHub Desktop.
n=1
a=["", ""]
$_.chomp.chars {|c| n.abs == 1 && (n*=c.to_i+1) || (s=n<=>0) && a[1<=>s] << c && (n-=s) && n!=s || (n*=-1) && n>0 && (p(a[1].to_f/a[0].to_f); a=["",""])}
# https://pbs.twimg.com/media/BvujU0bCIAMxa1O.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment