A 6x10x14
rectangular cuboid is made by stacking together 6*10*14 = 840 unit cubes. An
elliptic cone having minor axis = 6 units; major axis = 10 units, and height = 14 units is cut out of the cuboid by means of an infinitely thin laser-like cutting tool.
How many unit cubes will stay undamaged inside the elliptic cone?
Broken down by level, the numbers of unit cubes inside the cone, damaged by the cone, and outside the cone are as follows:
1 28 28 4
2 20 36 4
3 20 28 12
4 16 28 16
5 8 32 20
6 8 20 32
7 4 20 36
8 4 16 40
9 0 20 40
10 0 12 48
11 0 8 52
12 0 8 52
13 0 4 56
14 0 4 56
Total 108 264 468
DEFDBL A-Z
DIM vertex(14, 5, 3)
CLS
FOR h = 0 TO 14
ltot = 0: lCut = 0: lOutside = 0
r1 = 3 * (1 - h / 14)
r2 = 5 * (1 - h / 14)
f = SQR(r2 ^ 2 - r1 ^ 2)
dsum0 = 2 * r2
FOR x = 0 TO 5
FOR y = 0 TO 3
d1 = SQR((x - f) ^ 2 + y ^ 2)
d2 = SQR((x + f) ^ 2 + y ^ 2)
IF d1 + d2 <= dsum0 AND x > 0 AND y > 0 AND h > 0 THEN
ct = ct + 1
ltot = ltot + 1
END IF
IF d1 + d2 <= dsum0 THEN
vertex(h, x, y) = 1
END IF
IF d1 + d2 > dsum0 AND h > 0 AND x > 0 AND y > 0 THEN
IF vertex(h - 1, x - 1, y - 1) = 1 THEN
lCut = lCut + 1
ctCut = ctCut + 1
ELSE
lOutside = lOutside + 1
ctOutside = ctOutside + 1
END IF
END IF
IF ABS(d1 + d2 - dsum0) < .000001 THEN
IF d1 + d2 > dsum0 THEN
PRINT "warning"
END IF
END IF
NEXT
NEXT
IF h > 0 THEN PRINT h, ltot * 4; lCut * 4; lOutside * 4
NEXT h
PRINT ct * 4; ctCut * 4; ctOutside * 4
|
Posted by Charlie
on 2010-07-28 12:04:51 |