is it palindrome?


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

輸出

是否為回文

sample input1

5 1 2 2 1 5

sample output1

0

說明

因為1 2 2 1 5反過來看是5 1 2 2 1,不是回文

sample input2

4 2 3 3 2

sample output2

1

說明

因為2 3 3 2反過來看也是一樣,是回文

Comments

There are no comments at the moment.