fork(2) download
  1. float solve(String input) {
  2. def (hours, minutes) = input.split(/:/)*.toInteger()
  3. float minutesPhase = minutes / 60
  4. float hoursPhase = ((hours % 12) / 12) + (minutesPhase / 12)
  5. float phaseDiff = Math.abs(hoursPhase - minutesPhase)
  6. return 360 * (0.5 - Math.abs(phaseDiff - 0.5))
  7. }
  8.  
  9. println solve('15:20')
Success #stdin #stdout 1.51s 332288KB
stdin
Standard input is empty
stdout
19.999998