Submit | All submissions | Best solutions | Back to list |
TRCSTRPR - Prime Names |
Mina and Raju are playing a game. They will provide a list which contains a name and a number to each other. They have to add the number to the ASCII values of the names character. Then they have to check that if any of the new added number is prime or not. If for any character of the name the added number is prime then the name will be considered as prime name. Can you help Mina and Raju to find the prime name?
Example: Suppose the list contains two names Mina and Raju. The list will be as following:
- Mina 20
- Raju 34
For the first name ASCII values are: 77 105 110 97.
After addition the values will be: 97 125 130 117.
As 97 is prime number so Mina is a Prime Name.
Input
First line of input will be the size of the list L (L < 100). Next L line contains S (name) and N (number) pairs separated by space. Name is a string with less than 20 characters. The number will be less than 10000.
Output
For every name print “YES” if it is prime name, else print “NO”.
Example
Input: 2 Mina 20 Shimul 60 Output: YES NO
Added by: | Sarwar |
Date: | 2018-05-26 |
Time limit: | 0.5s-1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |