Problem
You are provided an array of size 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 .
Note: View the sample explanation section for more clarification.
Input format
- First line: A single integer denoting the size of array
- Second line: space-separated integers.
Output format
If the number is divisible by , then print . Otherwise, print .
Constraints
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation
Last digit of is .
Last digit of is .
Last digit of is .
Last digit of is .
Last digit of is .
Therefore the number formed is which is not divisible by .
SOLUTION:-
num=0;
d=0;
N = int(input())
data = [int(x) for x in input().split()]
for i in range(N):
d=data[i]
num=num*10+d
if num%10==0:
ans="Yes"
else:
ans="No"
# Write your code here
# ans =
print(ans)
No comments:
Post a Comment
HAY THAKYOU FOE VISIT