fork download
  1. #!/usr/bin/env bash
  2.  
  3. read w h d s
  4. r=$(bc<<<"scale=5;($d^4 / $h^4 - 1) * $h * $w * 3 / 13 / (1 + $s)")
  5. r=${r#-}
  6. q=$(bc<<<"scale=5;sqrt($r)")
  7. t="$(for i in $(seq 1 ${q%%.*}); do
  8. m=$(bc<<<"scale=5;$r/$i")
  9. echo "${m##*.}|$i: $m"
  10. done | sort -n | cut -d\| -f2-)"
  11. echo -e "\nsqrt = $q\n"
  12. head -15 <<<"$t"
  13. echo ""
  14. tail -15 <<<"$t"
  15.  
Success #stdin #stdout 0.08s 5292KB
stdin
70 178 211 0
stdout
sqrt = 52.93342

50: 56.03894
40: 70.04868
35: 80.05563
28: 100.06954
25: 112.07789
20: 140.09736
16: 175.12170
14: 200.13909
43: 65.16156
49: 57.18259
10: 280.19472
8: 350.24341
45: 62.26549
7: 400.27818
9: 311.32747

26: 107.76720
27: 103.77582
15: 186.79648
17: 164.82042
23: 121.82379
36: 77.83186
39: 71.84480
52: 53.88360
33: 84.90749
46: 60.91189
51: 54.94014
1: 2801.94729
2: 1400.97364
3: 933.98243
6: 466.99121