P20802 [GeeksforGeeks] Check if divisible by 114724
普及-
题目描述

Given a number S. Check whether it is divisble by 11 or not.
Example 1:
Input:
S = 76945
Output: 1
Explanation: The number is divisible by 11
as 76945 % 11 = 0.
​Example 2:
Input:
S = 12
Output: 0
Explanation: The number is not divisible
by 11 as 12 % 11 = 1.
Your Task:
You don't need to read input or print anything. Your task is to complete the function divisibleBy11() which takes the number in the form of string S as input and returns 1 if the number is divisible by 11. Else, it returns 0.
Expected Time Complexity: O(Log S) where S is the input number.
Expected Auxiliary Space: O(1).
Constraints:
1<=S<=10^{1000}+5

输入格式

见题面

输出格式

见题面

样例输入
S = 76945
样例输出
1