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.07s 5308KB
stdin
61 158 73 2
stdout
sqrt = 26.60088

7: 101.08673
22: 32.16396
15: 47.17380
26: 27.21565
16: 44.22544
19: 37.24248
25: 28.30428
18: 39.31150
11: 64.32792
20: 35.38035
13: 54.43131
8: 88.45089
24: 29.48363
5: 141.52142
14: 50.54336

8: 88.45089
24: 29.48363
5: 141.52142
14: 50.54336
1: 707.60713
9: 78.62301
17: 41.62394
21: 33.69557
10: 70.76071
23: 30.76552
2: 353.80356
3: 235.86904
4: 176.90178
6: 117.93452
12: 58.96726