Divisibility

3.6

321 votes
Basic Programming, Easy, Input/Output, Math
Problem

You are provided an array \(A\) of size \(N\) that contains non-negative integers. Your task is to determine whether the number that is formed by selecting the last digit of all the N numbers is divisible by \(10\).

Note: View the sample explanation section for more clarification.

Input format

  • First line: A single integer \(N\) denoting the size of array \(A\)
  • Second line: \(N\) space-separated integers.

Output format

If the number is divisible by \(10\), then print \(Yes\). Otherwise, print \(No\).

Constraints
\(1 \leq N\leq 10^5 \\ 0 \leq A[i] \leq 10^5\)

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Last digit of \(85\) is \(5\).
Last digit of \(25\) is \(5\).
Last digit of \(65\) is \(5\).
Last digit of \(21\) is \(1\).
Last digit of \(84\) is \(4\).
Therefore the number formed is \(55514\) which is not divisible by \(10\).

Editor Image

?