is there repeat?


Submit solution

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

Authors:
Problem type
Allowed languages
Java 19, Java 8

題目說明

程式輸入一個長度k,以及k個數字,若後面這k個數字中有某個數字重複出現,輸出1,若不存在重複的值,則輸出0。注意,判斷有無重複的時候,不考慮第一個輸入(也就是所謂的長度k)。

輸入格式

長度k,以及k個數字

輸入值範圍

輸入數字都是整數,最小值為-1000,最大值為1000。k大於等於1。

輸出

是否存在重複的值(0或1)

sample input1

3 1 2 3

sample output1

0

說明

因為1 2 3都沒有重複

sample input2

4 2 3 3 2

sample output2

1

說明

因為2 3 3 2裡面至少有一個數字重複出現

Comments

There are no comments at the moment.