2013-04-17 14:34:39 +08:00

30 lines
471 B
Python

def trinum(x):
if x == 1:
return True
x *= 2
sqr = int(x ** 0.5)
if x == sqr * (sqr + 1):
return True
else:
return False
filein = open('words.txt', 'r')
names = filein.read().split(',')
for ii in xrange(len(names)):
names[ii] = names[ii][1:-1]
def score(nn):
mark = 0
for i in nn:
mark += ord(i) - ord('A') + 1
return mark
count = 0
for i in names:
if trinum(score(i)):
#print '%3d\t' % score(i), i
count += 1
print count