tried stuff - nothing works yet
This commit is contained in:
32
09/main.go
32
09/main.go
@@ -12,8 +12,12 @@ type Point struct {
|
||||
X, Y int
|
||||
}
|
||||
|
||||
func (p Point) Area(p2 Point) float64 {
|
||||
return math.Abs(float64((p.X - p2.X + 1) * (p.Y - p2.Y + 1)))
|
||||
type Rect struct {
|
||||
P1, P2 *Point
|
||||
}
|
||||
|
||||
func (r Rect) Area() float64 {
|
||||
return math.Abs(float64((r.P1.X - r.P2.X + 1) * (r.P1.Y - r.P2.Y + 1)))
|
||||
}
|
||||
|
||||
func do(test bool) (int, int) {
|
||||
@@ -30,11 +34,27 @@ func do(test bool) (int, int) {
|
||||
}
|
||||
}
|
||||
|
||||
largestArea := 0.0
|
||||
largestArea := 0
|
||||
largestArea2 := 0
|
||||
|
||||
for ii, p1 := range points {
|
||||
for _, p2 := range points[ii+1:] {
|
||||
largestArea = math.Max(largestArea, p1.Area(p2))
|
||||
rects := make([]*Rect, len(points)*(len(points)+1)/2)
|
||||
|
||||
for ii := range points {
|
||||
for jj := range points[ii+1:] {
|
||||
rects[ii+jj+1] = &Rect{
|
||||
P1: &points[ii],
|
||||
P2: &points[jj+ii+1],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ii := range rects {
|
||||
rr := &rects[ii]
|
||||
|
||||
// iterate all others
|
||||
for jj := range rects {
|
||||
if jj != ii {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user