func main() {
	if len(os.Args) < 3 {
		fmt.Fprintf(os.Stderr, "Usage: %s <input_file> <output_file>", os.Args[0])
		os.Exit(-1)
	}

	var (
		fileHandle *os.File
		errIO      error
		points     []int
		w          int
		d          int
	)

	if fileHandle, errIO = os.Open(os.Args[1]); errIO != nil {
		panic(errIO)
	}
	topcoder.Read(fileHandle, &points, &w, &d)
	fileHandle.Close()

	if fileHandle, errIO = os.Create(os.Args[2]); errIO != nil {
		panic(errIO)
	}
	topcoder.Write(fileHandle, TheTournamentDivOne.Find(points, w, d))
}
Exemple #2
0
func main() {
	if len(os.Args) < 3 {
		fmt.Fprintf(os.Stderr, "Usage: %s <input_file> <output_file>", os.Args[0])
		os.Exit(-1)
	}

	var (
		fileHandle *os.File
		errIO      error
		X          []int
		Y          []int
		R          []int
		x1         int
		y1         int
		x2         int
		y2         int
	)

	if fileHandle, errIO = os.Open(os.Args[1]); errIO != nil {
		panic(errIO)
	}
	topcoder.Read(fileHandle, &X, &Y, &R, &x1, &y1, &x2, &y2)
	fileHandle.Close()

	if fileHandle, errIO = os.Create(os.Args[2]); errIO != nil {
		panic(errIO)
	}
	topcoder.Write(fileHandle, CirclesCountry.LeastBorders(X, Y, R, x1, y1, x2, y2))
}
Exemple #3
0
func main() {
	if len(os.Args) < 3 {
		fmt.Fprintf(os.Stderr, "Usage: %s <input_file> <output_file>", os.Args[0])
		os.Exit(-1)
	}

	var (
		fileHandle *os.File
		errIO      error
		treeCount  int
		width      int
		height     int
		distance   int
	)

	if fileHandle, errIO = os.Open(os.Args[1]); errIO != nil {
		panic(errIO)
	}
	topcoder.Read(fileHandle, &treeCount, &width, &height, &distance)
	fileHandle.Close()

	if fileHandle, errIO = os.Create(os.Args[2]); errIO != nil {
		panic(errIO)
	}
	topcoder.Write(fileHandle, BackyardTrees.CountWays(treeCount, width, height, distance))
}
Exemple #4
0
func main() {
	if len(os.Args) < 3 {
		fmt.Fprintf(os.Stderr, "Usage: %s <input_file> <output_file>", os.Args[0])
		os.Exit(-1)
	}

	var (
		fileHandle *os.File
		errIO      error
		N          int
	)

	if fileHandle, errIO = os.Open(os.Args[1]); errIO != nil {
		panic(errIO)
	}
	topcoder.Read(fileHandle, &N)
	fileHandle.Close()

	if fileHandle, errIO = os.Create(os.Args[2]); errIO != nil {
		panic(errIO)
	}
	topcoder.Write(fileHandle, PageNumbers.GetCounts(N))
}
Exemple #5
0
func main() {
	if len(os.Args) < 3 {
		fmt.Fprintf(os.Stderr, "Usage: %s <input_file> <output_file>", os.Args[0])
		os.Exit(-1)
	}

	var (
		fileHandle *os.File
		errIO      error
		field      []string
	)

	if fileHandle, errIO = os.Open(os.Args[1]); errIO != nil {
		panic(errIO)
	}
	topcoder.Read(fileHandle, &field)
	fileHandle.Close()

	if fileHandle, errIO = os.Create(os.Args[2]); errIO != nil {
		panic(errIO)
	}
	topcoder.Write(fileHandle, BuildingRoads.DestroyRocks(field))
}