Liste des Groupes | Revenir à cl c |
Michael S <already5chosen@yahoo.com> writes:
On Wed, 19 Mar 2025 00:38:44 -0400
DFS <nospam@dfs.com> wrote:
On 3/18/2025 11:07 PM, Tim Rentsch wrote:>
>
Have you thought about how large the value of 'n' can>
become inside the while() loop?
I was too smug in my first reply. After Keith pointed out I needed
to read from stdin, I submitted the code again and it passed some
tests but failed with 'OUTPUT LIMIT EXCEEDED' when n = 159487.
>
Updating int to long worked, and now I'm bona fide!
>
So thanks.
What you did happens to be sufficient for a particular environment
(supposedly, x86-64 Linux) used both by yourself and by the server
that tests results.
In more general case, 'long' is not guaranteed to handle numbers in
range up to 18,997,161,173 that can happen in this test.
The number 18997161173 is odd. The largest value reached is three
times that, plus 1, which is 56991483520.
Something like int64_t would be safer.
Using unsigned long long is safer still, and easier, because there
is no need for hoop-jumping to print them out with printx.
Les messages affichés proviennent d'usenet.