Sujet : Re: How to Make Cisterns
De : richard (at) *nospam* cogsci.ed.ac.uk (Richard Tobin)
Groupes : rec.puzzlesDate : 03. May 2025, 14:52:29
Autres entêtes
Organisation : Language Technology Group, University of Edinburgh
Message-ID : <vv572t$2l13g$2@artemis.inf.ed.ac.uk>
References : 1 2 3 4
User-Agent : trn 4.0-test76 (Apr 2, 2001)
In article <
vv55q1$3jq94$1@dont-email.me>,
Richard Heathfield <
rjh@cpax.org.uk> wrote:
int main(void)
{
int i;
int ms = 0;
int mv = 0;
for(i = 0; i < 1000000; i++)
{
int s = 1000000 - i;
int v = s * s * s;
Oh no it isn't. The cistern is not a cube.
I'm not sure which side your s is. If s is the side of the cistern,
then the height h is (1000000-s)/2, and v = s * s * h. If s is the
side of the cut-off square, then the base b is (1000000-2*s) and
v = b * b * s.
And of course the calculation overflows 32-bit ints.
-- Richard