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.18s 5324KB
stdin
67 166 359 3
stdout
sqrt = 115.73432

74: 181.00586
37: 362.01173
108: 124.02253
59: 227.02430
93: 144.02617
72: 186.03380
62: 216.03926
103: 130.04305
54: 248.04507
48: 279.05071
36: 372.06761
65: 206.06821
31: 432.07852
97: 138.08695
27: 496.09015

17: 787.90789
42: 318.91510
67: 199.91692
58: 230.93852
100: 133.94434
66: 202.94597
77: 173.95369
34: 393.95394
87: 153.95901
15: 892.96228
19: 704.97022
68: 196.97697
47: 284.98796
57: 234.99007
95: 140.99404