x to -x


Submit solution

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem type

題目說明

輸入一個整數x,如果該數字是正數,則輸出x, x-1, x-2, …, -x。如果該數字是負數,則輸出x, x+1, x+2, …, -x。 注意輸出的數字之間沒有換行,可以使用System.out.print(),而非System.out.println()。

輸入資料限制:輸入數字都是整數,最小為-1000,最大為1000。

輸入

一個整數x

輸出

x至-x之間所有整數

sample input1

-5

sample output1

-5 -4 -3 -2 -1 0 1 2 3 4 5

sample input2

3

sample output2

3 2 1 0 -1 -2 -3

sample input3

0

sample output3

0

Comments