Internet Problem Solving Contest

IPSC 2015

Problem M – Make*me-an+[integer!]

Esoteric languages are a popular subject of IPSC problems. The home page lists many cases where we gave you an unusual language with strange syntax and even stranger semantics and tasked you with doing something useful in it.

But then we realized: why bother with esoteric languages? Why don’t we just use a standard language everyone already knows? After all, that won’t make it any easier for you!

Problem specification

In this problem, you will use JavaScript (as standardized by ECMA-262). All you have to do is produce the integers from 0 to 1000. There’s just one catch: your programs can only use the characters ![]+-*.

Input specification

There is no input.

Output specification

The output should contain exactly 1001 lines. For each i between 0 and 1000, line i + 1 of your output should contain a valid JavaScript expression consisting only of the characters ![]+-* that evaluates to a number (i.e., typeof(result) == "number") with value i. Note that the expression must not contain any whitespace.

Additionally, your expressions must be short enough. For the easy subproblem M1, each JavaScript expression should be no longer than 200 characters. For the hard subproblem M2, no expression should exceed 75 characters.

Example output

... (999 more lines)


Testing your solution: open your browser’s developer console, or install node.js.

Pro tip: JavaScript seems like an easy language to learn. And it is, except for all its quirks and weird defaults. Unless you can score at least 21 out of 20 on quizzes such as this one, you shouldn’t just assume some expression will throw a parse error or runtime error. Even strange expressions can be valid.