Talk:A+B: Difference between revisions

92 bytes added ,  14 years ago
m
Line 26:
: Usually in such tasks (at least for the ACM ICPC) all input follows the initial specification so no checking is required. Usually the boundaries provided by the task description provide insight into how the problem can be solved; for example, if the problem size is very small it can well be an NP-complete problem you need to brute-force, for medium-sized problems an ''n''<sup>2</sup> algorithm might still be possible. If input numbers easily exceed 10<sup>9</sup> or so you shouldn't iterate through them and find a more clever solution. After all, your program has to solve a task in a certain time (usually between 1 and 5 seconds).
: So, in short, given where the problem comes from I consider checking the input superfluous. There are many more things not checked as well. The Ruby example will dutifully add as many whitespace-separated numbers as there are in the input; not just two. —[[User:Hypftier|Johannes Rössel]] 10:22, 13 May 2010 (UTC)
:: as does one of my Batch File solutions --[[User:Axtens|Axtens]] 14:37, 13 May 2010 (UTC)
 
: The task specifies that we need the sum of A and B and that they are between -1000 and 1000. It does NOT specify that we should not provide the sum when they are out of this range. I believe the intent was that outside of this range the behavior of the program is unspecified. --[[User:Rdm|Rdm]] 10:30, 13 May 2010 (UTC)
Anonymous user