P16241 [GeeksforGeeks] Prime string3953
普及-
题目描述

Provided a String of length N, your task is to find out whether or not the given string is a prime string. A prime string is a string in which the sum of the ASCII value of all the characters is prime.
Example 1:
Input: N = 13, S = "geeksforgeeks"
Output: YES
Explanation: As sum of ASCII is 1381,
which is prime.
​Example 2:
Input: India
Output: NO
Explanation: As sum of ASCII is 485,
which is not prime.
Your Task:
You don't need to read input or print anything. Your task is to complete the function isPrimeString() which takes the length of string and the string as inputs and returns true if that is a prime string, else false.
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ |S| ≤ 10^{6}

输入格式

见题面

输出格式

见题面

样例输入
N = 13, S = "geeksforgeeks"
样例输出
YES