#C368. Lock Opening Based on Prime Sum
Lock Opening Based on Prime Sum
Lock Opening Based on Prime Sum
You are given an integer T representing the number of test cases. For each test case, you are given an integer N. Your task is to calculate the sum of the digits of N, denoted as \(S = \sum_{i} d_i\), where \(d_i\) are the digits of N. If \(S\) is a prime number, then the lock opens and you should output YES
; otherwise, output NO
.
Note: The number 1 is not considered as a prime number.
inputFormat
The input is read from stdin and consists of multiple lines. The first line contains an integer T (the number of test cases). Each of the following T lines contains a single integer N.
outputFormat
For each test case, output a single line to stdout containing YES
if the sum of digits of N is a prime number, or NO
otherwise.
5
123
124
1
999999999
1000000000
NO
YES
NO
NO
NO
</p>