Sujet : Re: How to Make Cisterns
De : rjh (at) *nospam* cpax.org.uk (Richard Heathfield)
Groupes : rec.puzzlesDate : 03. May 2025, 15:26:52
Autres entêtes
Organisation : Fix this later
Message-ID : <vv593c$3n6ot$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 03/05/2025 14:52, Richard Tobin wrote:
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.
Bugger 1.
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.
Bugger 2!
Redoubled in buggers. I quit!
(For a few moments, at least.)
-- Richard HeathfieldEmail: rjh at cpax dot org dot uk"Usenet is a strange place" - dmr 29 July 1999Sig line 4 vacant - apply within