project euler 18/67

def get_count():
	count=0
	for line in f:
		count=count+1
	return count

m=100
>>> numm=[[0]*(m+1) for i in range(0,m+1)]

def scann():
	f=open(a,"r")
	index=0
	start=0
	end=2
	for line in f:
		line.strip('\n')
		for i in range(0,index+1):
			nums[index][i]=int(line[start:end])
			start=start+3
			end=end+3
		start=0
		end=2
		index=index+1
	f.close()

def problem_67():
	d=[[0]*(m+1) for i in range(0,m+1)]
	for i in range(m-1,-1,-1):
		for j in range(0,i+1):
			d[i][j]=nums[i][j]+max(d[i+1][j],d[i+1][j+1])
	return d[0][0]

你可能感兴趣的:(python,Project,Euler)