#176. 数字列表乘2筛选末位非2

    ID: 176 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatFunctional-2gesp1循环结构条件结构

数字列表乘2筛选末位非2

Number Processing and Filtering

Background

Congcong is currently learning how to process lists of numbers. He encountered an interesting problem that requires performing some operations and filtering on a given list of numbers.

Problem Description

Given a list of non-negative integers, return a new list containing the result of multiplying each number in the original list by 22, omitting any of the resulting numbers that end in 22.

Input Format

The input is given from standard input in the following format.

The input consists of a single line, representing a list of non-negative integers. The numbers in the list are separated by spaces.

Output Format

The output is printed to standard output in the following format.

The output consists of a single line, representing the processed list of integers. The numbers in the list are separated by commas and spaces, enclosed in square brackets [].

Sample

1 2 3
[4, 6]
2 6 11
[4]
0
[0]

Sample Explanation

  • Sample 1:
    • 1×2=21 \times 2 = 2 (ends in 22, omitted)
    • 2×2=42 \times 2 = 4 (kept)
    • 3×2=63 \times 2 = 6 (kept)
    • The final result is [4,6][4, 6].
  • Sample 2:
    • 2×2=42 \times 2 = 4 (kept)
    • 6×2=126 \times 2 = 12 (ends in 22, omitted)
    • 11×2=2211 \times 2 = 22 (ends in 22, omitted)
    • The final result is [4][4].
  • Sample 3:
    • 0×2=00 \times 2 = 0 (kept)
    • The final result is [0][0].

Constraints

Time limit: 11 second, Memory limit: 10241024 KiB for each test case.