#7. 判断数组首尾元素是否相等

    ID: 7 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatArray-1gesp1条件结构

判断数组首尾元素是否相等

Array First Last Equal

Background

Congcong is learning about arrays, and Dawei has given him a simple task to check a property of an array.

Problem Description

Given an array of integers. Return true if the array's length is 11 or more, and its first element is equal to its last element; otherwise, return false.

Input Format

Input is given from standard input in the following format.

A single line containing several space-separated integers, representing the elements of the array.

Output Format

Output is printed to standard output in the following format.

Output true if the array satisfies the condition; otherwise, output false.

Sample

1 2 3
false
1 2 3 1
true
1 2 1
true

Sample Explanation

  • Sample 1: The array is [1 2 3]. The array length is 33, which is greater than or equal to 11. The first element is 11, and the last element is 33. Since 131 \neq 3, the output is false.
  • Sample 2: The array is [1 2 3 1]. The array length is 44, which is greater than or equal to 11. The first element is 11, and the last element is 11. Since 1=11 = 1, the output is true.
  • Sample 3: The array is [1 2 1]. The array length is 33, which is greater than or equal to 11. The first element is 11, and the last element is 11. Since 1=11 = 1, the output is true.

Constraints

Time limit: 11 second, Memory limit: 10241024 KiB.