Skip to main content
1 of 3
steenbergh
  • 8.1k
  • 1
  • 25
  • 41

QBIC, 31 bytes

~:>:|≈:-a>0|q=q+1┘c=c-a+b]?q\?0

##Explanation

~           IF
 :          cmd line arg 'a'  (the increment of our snail)
  >         is greater than
   :        cmd line arg 'b'  (the decrement, or daily drop)
    |       THEN
≈           WHILE
 :          cmd line arg 'c'  (the height of the well)
  -a        minus the increment (we count down the hieght-to-go)
    >0|     is greater than 0 (ie while we haven't reached the top yet)
q=q+1       Add a day to q (day counter, starts at 1)
┘           (syntactic linebreak)
c=c-a+b     Do the raise-and-drop on the height-to-go
]           WEND
?q          PRINT q (the number of days)
\?0         ELSE (incrementer <= decrementer) print 0 (no solution)
steenbergh
  • 8.1k
  • 1
  • 25
  • 41