#194. 数组最大特殊分数求和

    ID: 194 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatAp-1gesp4函数一维数组

数组最大特殊分数求和

Sum of Largest Special Scores

Background

Congcong is currently exploring special numbers within arrays. He is interested in efficiently finding specific values in an array.

Problem Description

Given two arrays, AA and BB, of non-negative integer scores. A "special" score is one which is a multiple of 1010, such as 4040 or 9090. Return the sum of the largest special score in AA and the largest special score in BB. To practice decomposition, write a separate helper method which finds the largest special score in an array. Write your helper method after your scoresSpecial() method.

Input Format

Input is given from standard input in the following format.

Two arrays, AA and BB. Each array's elements are space-separated and enclosed in square brackets [], with the two arrays also separated by a space.

Output Format

Output to standard output in the following format.

An integer, representing the sum of the largest special scores from both arrays.

Sample

[12 10 4] [2 20 30]
40
[20 10 4] [2 20 10]
40
[12 11 4] [2 20 31]
20

Sample Explanation

Sample 1: The largest special score in array A=[12,10,4]A = [12, 10, 4] is 1010. The largest special score in array B=[2,20,30]B = [2, 20, 30] is 3030. Their sum is 10+30=4010 + 30 = 40.

Sample 2: The largest special score in array A=[20,10,4]A = [20, 10, 4] is 2020. The largest special score in array B=[2,20,10]B = [2, 20, 10] is 2020. Their sum is 20+20=4020 + 20 = 40.

Sample 3: Array A=[12,11,4]A = [12, 11, 4] has no special scores, so the largest special score is 00. The largest special score in array B=[2,20,31]B = [2, 20, 31] is 2020. Their sum is 0+20=200 + 20 = 20.

Constraints

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