新手指导/ICPC introduction(3)

TimeLimit:1000MS  MemoryLimit:64MB
64-bit integer IO format:%lld
未提交 | 登录后收藏 | 已有35人收藏了本题
Problem Description

强调与复习

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并不完全一样):

读入一个整数,并把这个数的相反数输出。

Input

输入数据有多行,每行有一个整数。当输入的整数为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.

Output

输出数据同样有多行,每行对应输出相应整数的相反数。

The should be multiple lines of output. Each line should contain a single integer, which is the negated number of the corresponding input.

SampleInput
1
2
0
SampleOutput
-1
-2
Submit
题目统计信息详细
总AC数2077
通过人数1829
尝试人数1944
总提交量5261
AC率34.77%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: