[Problem B3-易] Unique elements
成績: 0 / 倒扣: 0.8
Time Limit: 1 second
Problem Description
Problem Description
● EnglishTechnical Specification
Given a sequence of integers, please find the unique elements those occur only once in the sequence.
● Chinese
給定一個整數數列,請找出數列中單獨的元素,也就是只出現一次的整數。
● EnglishInput Format
● Chinese
- The number of integers in the sequence is n, where 1 ≤ n ≤ 1000.
- The integers in the sequence are 32-bit integers.
- 數列中整數的個數為 n , 1 ≤ n ≤ 1000 。
- 數列中的整數是 32 位元整數。
● EnglishOutput Format
The input contains several test cases. Each test case contains two lines: the first line is an integer n which indicates the number of integers in the sequence; the second line contains a sequence of n integers, and consecutive integers are separated by a blank.
● Chinese
輸入包含若干測資,每筆測資包含兩行資料:第一行是一個整數 n 代表數列中有 n 個整數;第二行則是包含 n 個整數的數列,相鄰整數間以空格隔開。
● EnglishExample
For each test case, output the unique elements in increasing order in one line, and consecutive numbers are separated by a blank. If there is no unique element, output “N/A”.
● Chinese
針對每一筆測試資料,由小至大輸出單獨元素在一行中,相鄰數字間以空格隔開。如果沒有單獨元素,則輸出 “N/A” 。
Sample Input: | Sample Output: |
8 1 1 1 9 9 2 2 2 5 1 2 3 4 5 10 8 7 7 1 0 0 9 2 2 6 | N/A 1 2 3 4 5 1 6 8 9 |
[註]這題是找出數列中唯一出現一次的數,因此可以設一個array,計算數出現的頻率,並將頻率為1的值輸出
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。