强调与复习
One step forward:
There will be multiple test cases for an ICPC problem. In this situation, the format of input will be given. The exit condition will be mentioned as well. A common solution for reading such input is to put your program inside a while loop, which terminates (with a break) when it sees the exit condition.
Try to solve this task, which is slightly different from problem 2:
Read a integer, output the negated number.
-END OF ENGLISH VERSION-
=============================================================
通常ACM题目的输入数据不止一项,对于多组数据输入的情况,题目会说明输入数据的结束条件,队员在写处理代码的时候,最简单的方法就是外面一个while (1)的死循环,然后内部对于结束条件进行判断,如果满足条件即break。
请完成下面这个题目(注意,此题和指导题2并不完全一样):
读入一个整数,并把这个数的相反数输出。
输入数据有多行,每行有一个整数。当输入的整数为0时表示退出,不必输出0的相反数。
There will be multiple test cases. Each test case is in a separate line. The input ends with a zero, the negative of which should not appear in the output.
输出数据同样有多行,每行对应输出相应整数的相反数。
The should be multiple lines of output. Each line should contain a single integer, which is the negated number of the corresponding input.
1 2 0
-1 -2