Skip to main content
added 81 characters in body; added 111 characters in body
Source Link
Ventero
  • 10.1k
  • 3
  • 25
  • 55

Ruby 1.9, 52  46 (42) characters

eval"A,B="+gets;i=0;p eval"(A-B+i+=1)/i*"*B+?1 

If stderr is ignored:

eval"A,B=I="+gets;p eval"I/(A-I-=1)*"*B+?1 

Ruby 1.8, 43 characters, no additional output to stderr:

eval"a,b=i="+gets;p eval"i/(a-i-=1)*"*b+"1" 

Edits:

  • (52 -> 48) Found a shorter way to parse the input
  • (48 -> 46) Less looping, more eval.

Ruby 1.9, 52 46 characters

eval"A,B="+gets;i=0;p eval"(A-B+i+=1)/i*"*B+?1 

Edits:

  • (52 -> 48) Found a shorter way to parse the input
  • (48 -> 46) Less looping, more eval.

Ruby 1.9, 52  46 (42) characters

eval"A,B="+gets;i=0;p eval"(A-B+i+=1)/i*"*B+?1 

If stderr is ignored:

eval"A,B=I="+gets;p eval"I/(A-I-=1)*"*B+?1 

Ruby 1.8, 43 characters, no additional output to stderr:

eval"a,b=i="+gets;p eval"i/(a-i-=1)*"*b+"1" 

Edits:

  • (52 -> 48) Found a shorter way to parse the input
  • (48 -> 46) Less looping, more eval.
edited body
Source Link
Ventero
  • 10.1k
  • 3
  • 25
  • 55

Ruby 1.9, 52 46 characters

eval"A,B="+gets;i=0;p eval"(A-B+i+=1)/i*"*B+?1 

Edits:

  • (52 -> 48) Found a shorter way to parse the input
  • (48 -> 4746) Less looping, more eval.

Ruby 1.9, 52 46 characters

eval"A,B="+gets;i=0;p eval"(A-B+i+=1)/i*"*B+?1 

Edits:

  • (52 -> 48) Found a shorter way to parse the input
  • (48 -> 47) Less looping, more eval.

Ruby 1.9, 52 46 characters

eval"A,B="+gets;i=0;p eval"(A-B+i+=1)/i*"*B+?1 

Edits:

  • (52 -> 48) Found a shorter way to parse the input
  • (48 -> 46) Less looping, more eval.
added 50 characters in body; deleted 1 characters in body
Source Link
Ventero
  • 10.1k
  • 3
  • 25
  • 55

Ruby 1.9, 52 4846 characters

eval"A,B="+gets;s=1;1.uptoB="+gets;i=0;p eval"(A-BB+i+=1){|i|s+=s*B/i};p si*"*B+?1 

Edits:

  • (52 -> 48) Found a shorter way to parse the input
  • (48 -> 47) Less looping, more eval.

Ruby 1.9, 52 48 characters

eval"A,B="+gets;s=1;1.upto(A-B){|i|s+=s*B/i};p s 

Edits:

  • Found a shorter way to parse the input

Ruby 1.9, 52 46 characters

eval"A,B="+gets;i=0;p eval"(A-B+i+=1)/i*"*B+?1 

Edits:

  • (52 -> 48) Found a shorter way to parse the input
  • (48 -> 47) Less looping, more eval.
deleted 21 characters in body
Source Link
Ventero
  • 10.1k
  • 3
  • 25
  • 55
Loading
Source Link
Ventero
  • 10.1k
  • 3
  • 25
  • 55
Loading