예제 #1
0
파일: C.go 프로젝트: gbataille/GregsSandbox
func main() {
	// s := (math.Trunc(math.Sqrt(5)*math.Pow(10,10)) + 1) / math.Pow(10,10)
	s := math.Sqrt(5)
	t := 31
	results := make([][4]uint64, t, t)
	results[0] = [4]uint64{1, 0, 0, 0}
	results[1] = [4]uint64{3, 0, 1, 0}
	for i := 2; i < t; i++ {
		a := results[i-1][0]
		b := results[i-1][1]
		c := results[i-1][2]
		d := results[i-1][3]

		ai := 3*a + 3000*b + 5*c + 5000*d
		ci := 3*c + 3000*d + a + 1000*b

		results[i] = [4]uint64{ai % 1000, (ai / 1000) % 10000000000, ci % 1000, (ci / 1000) % 10000000000}
	}

	// CONFIG TO DO EVERY TIME
	const headerLines int = 1
	const caseSize int = 1

	fmt.Println("-- Start")
	filename := gxbUtilsOld.SetupEnv()
	_, problems := gxbUtilsOld.ReadInputFile(filename, headerLines, caseSize)
	solutions := make([][]string, len(problems), len(problems))

	for i := 0; i < len(problems); i++ {
		solutions[i] = handleCase(problems[i], results, s)
	}

	gxbUtilsOld.OutputResults(solutions, filename)
	fmt.Println("-- Done")
}
예제 #2
0
파일: A.go 프로젝트: gbataille/GregsSandbox
func main() {
	// CONFIG TO DO EVERY TIME
	const headerLines int = 1
	const caseSize int = 3

	filename := gxbUtilsOld.SetupEnv()

	_, problems := gxbUtilsOld.ReadInputFile(filename, headerLines, caseSize)
	solutions := make([][]string, len(problems), len(problems))

	for i := 0; i < len(problems); i++ {
		solutions[i] = handleCase(problems[i])
	}

	gxbUtilsOld.OutputResults(solutions, filename)
}
예제 #3
0
func main() {
	// CONFIG TO DO EVERY TIME
	headerLines := 1
	caseSize := 1

	filename := gxbUtilsOld.SetupEnv()

	_, problems := gxbUtilsOld.ReadInputFile(filename, headerLines, caseSize)
	solutions := make([][]string, len(problems), len(problems))

	i := 0
	for i < len(problems) {
		solutions[i] = handleCase(problems[i])
		i += 1
	}

	gxbUtilsOld.OutputResults(solutions, filename)
}