Talk:A+B: Difference between revisions

961 bytes added ,  14 years ago
(→‎Input Specification: A, B in [-1000, 1000] ?)
Line 23:
===Input specification ("constraints")===
The task's text says that A and B are (must be? should be?) between -1000 and 1000; no a single example checks this. Is it a mandatory requirement we should add the check for, or it can be ignored? —[[User:ShinTakezou|ShinTakezou]] 06:30, 13 May 2010 (UTC)
 
: 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)
Anonymous user