sum equals 10?


Submit solution

Points: 20
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

題目說明

<1121檢定考題>
輸入一連串數字,第1個輸入值是n表示陣列長度,第2到n+1個輸入值是陣列內容,
n是大於0的整數,其他輸入值都是大於等於0且小於等於10的整數。

針對每一個數字逐一判斷,若陣列中存在另外一個數字與其加總等於10,則輸出1,否則輸出0。
例如4 1 2 3 9, 則輸出1 0 0 1,因為1和9加總等於10,但是2和3都找不到另一個數字與他加總等於10。

輸入

一連串數字,第1個輸入值是n表示陣列長度,第2到n+1個輸入值是陣列內容,
n是大於0的整數,其他輸入值都是大於等於0且小於等於10的整數。

輸出

針對每一個數字逐一判斷,若陣列中存在另外一個數字與其加總等於10,則輸出1,否則輸出0。

sample input1

10 1 2 3 4 5 6 7 8 9 10

sample output1

1 1 1 1 0 1 1 1 1 0

sample input2

6 1 3 3 9 8 7

sample output2

1 1 1 1 0 1

sample input3

5 1 2 3 0 10

sample output3

0 0 0 1 1

Comments

There are no comments at the moment.