Replacing a Sentinel Error Code
Northgate Water still runs one logger from the 1990s, and that logger has no way to write "no reading". When its probe fails it writes -999 instead, a value chosen because no river could ever produce it. The downstream tools do not know the convention and would happily average it in, so the export step neutralises it: every -999 becomes a plain 0 before the file leaves the building. Nothing else is touched — a genuine negative level is a real reading and must survive exactly as recorded.
Task: Print the export-ready readings.
Input
The first line holds an integer n, the count of readings. Each of the next n lines holds one reading. Some of them are the marker -999.
Output
One line holding n readings separated by single spaces, in the order they were read, each written as a plain integer. Every marker shows as 0; every other reading is unchanged.
Example:
Input:
4
10
-999
20
-999
Output:
10 0 20 0
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in