#88. 数组中数字3的出现次数与相邻性

    ID: 88 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatArray-2gesp3一维数组模拟

数组中数字3的出现次数与相邻性

Exact Three Threes

Background

Congcong has recently been studying array properties. He encountered an interesting problem that requires determining if an array satisfies specific conditions.

Problem Description

Given an array of integers, return true if the value 33 appears in the array exactly 33 times, and no two 33's are next to each other; otherwise, return false.

Input Format

The input consists of a single line representing an integer array. Array elements are separated by spaces and enclosed in square brackets [].

[A_1 A_2 ... A_N]

Output Format

Output to standard output in the following format.

Output true if the conditions are met; otherwise, output false.

Sample

[3 1 3 1 3]
true
[3 1 3 3]
false
[3 4 3 3 4]
false

Sample Explanation

Sample 1: In the array [3 1 3 1 3], the number 33 appears 33 times, and no two 33's are adjacent. Thus, the output is true.

Sample 2: In the array [3 1 3 3], the number 33 appears 33 times, but the last two 33's are adjacent. Thus, the output is false.

Sample 3: In the array [3 4 3 3 4], the number 33 appears 33 times, but the middle two 33's are adjacent. Thus, the output is false.

Constraints

The length of the array NN satisfies 1N1001 \le N \le 100. Each element AiA_i in the array satisfies 0Ai10000 \le A_i \le 1000. Time limit: 11 second, Memory limit: 10241024 KiB.