The problem is to check whether the decimal representation of a given binary number is divisible by 5 or not.
Example 1:
Input: bin = "1010"
Output: "Yes"
Explanation: Decimal equivalent is
10 which is divisible by 5.
Ã¢â¬â¹Example 2:
Input: bin = "1110"
Output: "No"
Explanation: Decimal equivalent is
14 which is not divisible by 5.
Your Task:  
You don't need to read input or print anything. Your task is to complete the function isDivisibleBy5() which takes the string bin as inputs and returns the "Yes" if binary number is divisible by 5, else returns "No".
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ |S| ≤ 10^{5}

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Bit manipulation

Data structures

Starter code: #User function Template for python3

class Solution:

    def isDivisibleBy5(self, Bin):
        # code here

Solutions:
class Solution:

	def isDivisibleBy5(self, Bin):
		i = int(Bin, 2)
		if i % 5 == 0:
			return 'Yes'
		return 'No'


class Solution:

	def isDivisibleBy5(self, Bin):
		d = int(Bin, 2)
		if d % 5 == 0:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDivisibleBy5(self, b):
		n = int(b, 2)
		if n % 5:
			return 'No'
		else:
			return 'Yes'


class Solution:

	def isDivisibleBy5(self, bin):
		k = int(bin, 2)
		if k % 5 == 0:
			return 'Yes'
		return 'No'


class Solution:

	def isDivisibleBy5(self, Bin):
		k = int(Bin, 2)
		s = 'Yes'
		s1 = 'No'
		if k % 5 == 0:
			return s
		else:
			return s1


class Solution:

	def isDivisibleBy5(self, Bin):
		Bin = str(int(Bin, 2))[-1]
		if Bin == '5' or Bin == '0':
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDivisibleBy5(self, num):
		x = int(num, 2)
		if x % 5 == 0:
			return str('Yes')
		else:
			return str('No')


class Solution:

	def isDivisibleBy5(self, Bin):
		a = int(str(Bin), 2)
		if a % 5 == 0:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDivisibleBy5(self, b):
		dec = int(b, 2)
		if dec % 5 == 0:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDivisibleBy5(self, Bin):
		decBin = int(Bin, 2)
		rem = decBin % 5
		if rem == 0:
			return 'Yes'
		else:
			return 'No'


class Solution:

	def isDivisibleBy5(self, n):
		s = int(n, 2)
		if s % 5 == 0:
			return 'Yes'
		return 'No'


class Solution:

	def isDivisibleBy5(self, Bin):
		a = int(Bin, 2)
		if a % 5 == 0:
			return 'Yes'
		else:
			return 'No'
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		Bin = input()
		solObj = Solution()
		print(solObj.isDivisibleBy5(Bin))