Divisibility
Basic programming
Easy
Input/output
Math
78.0% success
222,905 attempts
1s time
256MB memory
1024KB max code
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\)
Examples
Input
5 85 25 65 21 84
Output
No
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\).
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Loading Editor...