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.09s 5312KB
stdin
65 168 211 0
stdout
sqrt = 61.24022

50: 75.00729
30: 125.01216
25: 150.01459
15: 250.02432
10: 375.03648
23: 163.05933
6: 625.06080
5: 750.07296
3: 1250.12160
52: 72.12240
48: 78.13260
35: 107.15328
39: 96.16320
36: 104.17680
2: 1875.18240

58: 64.66146
38: 98.69381
9: 416.70720
40: 93.75912
53: 70.76160
7: 535.76640
47: 79.79499
8: 468.79560
57: 65.79587
14: 267.88320
27: 138.90240
28: 133.94160
11: 340.94225
56: 66.97080
31: 120.97950