P18021 [GeeksforGeeks] Perfect square string5914
普及-
题目描述

You are given a string S. Your task is to determine if the sum of ASCII values of all character results in a perfect square or not. If it is a perfect square then the answer is 1, otherwise 0.
Example 1:
Input: S = "d"
Output: 1
Explanation: Sum of ASCII of S is 100
which is a square number.
​Example 2:
Input: S = "1Qy"
Output: 0
Explanation: Sum of ASCII of S is
251 which is not a square.
Your Task:
You don't need to read input or print anything. Your task is to complete the function isSquare() which takes the string S as inputs and returns the answer.
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ |S| ≤ 10^{5}

输入格式

见题面

输出格式

见题面

样例输入
S = "d"
样例输出
1