Ejemplo n.º 1
0
func Exercise67() int {
	tri := utils.ReadFileOrURL("../docs/exercise67.dat", "http://projecteuler.net/project/triangle.txt")
	lines := triangles.Splittext(tri)
	nlines := len(lines)
	max, _ := triangles.Maxroute(lines[1:nlines])
	return max
}
Ejemplo n.º 2
0
func Exercise22() uint64 {
	data := utils.ReadFileOrURL("../docs/exercise22.dat", "http://projecteuler.net/project/names.txt")
	data = strings.Replace(data, "\"", "", -1)
	names := strings.Split(data, ",")
	sort.Strings(names)
	total := uint64(0)
	for pos, name := range names {
		value := uint64(AlphabetValue(name))
		value *= uint64(pos + 1)
		total += value
	}
	return total
}