Workings & Source for Project Euler solutions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
399 B

triSet=set()
for i in range(1,601):
triSet.add(i*(i+1)*0.5)
fobj=open("p042_words.txt")
for line in fobj:
names=line
fobj.close()
print(names)
answer=0
workingcount=0
for i in range(0,len(names)):
if names[i]=="\"" or names[i]==",":
if workingcount!=0:
if workingcount in triSet:
answer=answer+1
workingcount=0
else:
workingcount=workingcount+ord(names[i])-64
print(answer)