1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import sys
import math
s=sys.stdin.readline()
cnt=0
for i in range(len(s)-1):
if 96<ord (s[i]) and ord (s[i])<123 : cnt+= ord(s[i]) -96
elif 64 < ord(s[i]) and ord( s[i]) < 91: cnt += ord(s[i]) - 64
#print(cnt)
if cnt==1 : print("It is a prime word.")
else:
check = 0
for i in range(2, int (math.sqrt(cnt))+1):
if cnt%i==0: print("It is not a prime word."); check=1; break
if check==0: print("It is a prime word.")
|
cs |
반응형
댓글