git reimport
This commit is contained in:
69
archive/2017.01/2017.01.07 - unsorted/C.java
Normal file
69
archive/2017.01/2017.01.07 - unsorted/C.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
|
||||
public class C {
|
||||
class Point {
|
||||
final int x;
|
||||
final int y;
|
||||
|
||||
public Point(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Point point = (Point) o;
|
||||
|
||||
if (x != point.x) return false;
|
||||
return y == point.y;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = x;
|
||||
result = 31 * result + y;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Point sub(Point p) {
|
||||
return new Point(x - p.x, y - p.y);
|
||||
}
|
||||
|
||||
public Point add(Point p) {
|
||||
return new Point(x + p.x, y + p.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return x + " " + y;
|
||||
}
|
||||
}
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
Point a = new Point(in.nextInt(), in.nextInt());
|
||||
Point b = new Point(in.nextInt(), in.nextInt());
|
||||
Point c = new Point(in.nextInt(), in.nextInt());
|
||||
|
||||
Set<Point> points = new HashSet<>();
|
||||
|
||||
points.add(a.add(b.sub(a)).add(c.sub(a)));
|
||||
points.add(b.add(a.sub(b)).add(c.sub(b)));
|
||||
points.add(c.add(a.sub(c)).add(b.sub(c)));
|
||||
|
||||
out.println(points.size());
|
||||
|
||||
for (Point point : points) {
|
||||
out.println(point);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user