#!/usr/bin/env perl # # Small script to calculate the box area and volume foreach (1 .. 300) { $w = $_; foreach ( 1 .. 300) { $l = $_; $h = 2 / 3 * $l; $v = $w * $l * $h; $a = 2 * ($w * $h + $w * $l + $l * $h); if ( $v >= 60 and $v < 300 ) { $f = sqrt((400 - $v) ** 2 + $a ** 2); $v = int($v); $a = int($a); $f = int($f); print "$f $a $v\n"; } } }