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.05s 5304KB
stdin
70 172 180 0
stdout
sqrt = 23.53951

2: 277.05429
23: 24.09167
1: 554.10858
7: 79.15836
19: 29.16360
12: 46.17571
22: 25.18675
8: 69.26357
6: 92.35143
11: 50.37350
21: 26.38612
10: 55.41085
4: 138.52714
9: 61.56762
14: 39.57918

6: 92.35143
11: 50.37350
21: 26.38612
10: 55.41085
4: 138.52714
9: 61.56762
14: 39.57918
17: 32.59462
13: 42.62373
16: 34.63178
3: 184.70286
20: 27.70542
18: 30.78381
5: 110.82171
15: 36.94057