#75. 检查数组中2的和是否为8
检查数组中2的和是否为8
Check if Sum of Twos is 8
Background
Congcong is playing a number game where he needs to check if certain arrays meet specific conditions.
Problem Description
Given an array of integers, return true if the sum of all occurrences of the number in the array is exactly . Otherwise, return false.
Input Format
Input is given from standard input in the following format.
A single line containing multiple space-separated integers. These integers might be enclosed in square brackets
[], but you should only process the numbers within.
Output Format
Output is printed to standard output in the following format.
Output
trueif the sum of all occurrences of the number in the array is exactly ; otherwise, outputfalse.
Sample
[2 3 2 2 4 2]
true
[2 3 2 2 4 2 2]
false
[1 2 3 4]
false
Sample Explanation
Sample 1: The array [2 3 2 2 4 2] contains four s. Their sum is . Thus, true is output.
Sample 2: The array [2 3 2 2 4 2 2] contains five s. Their sum is . This is not equal to , so false is output.
Sample 3: The array [1 2 3 4] contains one . Its sum is . This is not equal to , so false is output.
Constraints
Time limit: second per test case. Memory limit: KiB per test case.