#B3992. Filter Out Bad Integers
Filter Out Bad Integers
Filter Out Bad Integers
You are given an integer ( n ) and then ( n ) integers. An integer is considered "bad" if it meets either of the following conditions:
- Its ones digit is (3) (i.e. the last digit is 3).
- It is a multiple of (3) (i.e. divisible by 3).
Your task is to filter out all the bad integers and then compute the sum and the count of the remaining integers.
For example, if the input is:
5 1 2 3 13 6
The integers 3, 13, and 6 are considered bad since 3 is a multiple of 3, 13 ends with 3, and 6 is divisible by 3. The remaining numbers are 1 and 2, so the sum is 3 and the count is 2.
inputFormat
The input consists of two lines:
- The first line contains a single integer ( n ) which indicates the number of integers.
- The second line contains ( n ) space-separated integers.
outputFormat
Output two integers separated by a space: the sum of the remaining integers and their count.
sample
5
1 2 3 13 6
3 2