Liste des Groupes | Revenir à cl c |
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.
Something like int64_t would be safer.
Les messages affichés proviennent d'usenet.