import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main (String[] args) throws FileNotFoundException, IOException {
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb=new StringBuffer();
String line;
while ((line = in.readLine()) != null) {
Point []points=new Point[4];
StringTokenizer st=new StringTokenizer(line," ");
for(int i=0;i<4;i++){
points[i]=parsePoint(st.nextToken());
}
Point center=new Point(0,0);
for(int i=0;i<4;i++){
center.x+=points[i].x;
center.y+=points[i].y;
}
center.x/=4;
center.y/=4;
boolean flag=true;
double dist=eculDist(center, points[0]);
for(int i=1;i<4;i++){
double temp=eculDist(center, points[i]);
if(temp!=dist){
sb.append(false).append("\n");
flag=false;
break;
}
}
if(flag){
int counter=0;
for(int i=1;i<4;i++){
if(dotProd(difPoint(points[0], center), difPoint(points[i], center))==0)
counter++;
}
if(counter==2){
sb.append(true).append("\n");
}
else{
sb.append(false).append("\n");
}
}
}
System.out.print(sb);
}
static double eculDist(Point p1,Point p2){
return Math.sqrt(((p1.x-p2.x)*(p1.x-p2.x))+((p1.y-p2.y)*(p1.y-p2.y)));
}
static double dotProd(Point p1,Point p2){
return p1.x*p2.x+p1.y*p2.y;
}
static Point difPoint(Point p1,Point p2){
return new Point(p1.x-p2.x,p1.y-p2.y);
}
static Point parsePoint(String string){
StringBuilder str=new StringBuilder(string);
str.deleteCharAt(0);
if(str.charAt(str.length()-1)==',')
str.deleteCharAt(str.length()-1);
str.deleteCharAt(str.length()-1);
StringTokenizer st2=new StringTokenizer(str.toString(),",");
return new Point(Integer.parseInt(st2.nextToken()),Integer.parseInt(st2.nextToken()));
}
}
class Point{
double x;
double y;
public Point(double x, double y) {
this.x = x;
this.y = y;
}
}
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main (String[] args) throws FileNotFoundException, IOException {
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb=new StringBuffer();
String line;
while ((line = in.readLine()) != null) {
Point []points=new Point[4];
StringTokenizer st=new StringTokenizer(line," ");
for(int i=0;i<4;i++){
points[i]=parsePoint(st.nextToken());
}
Point center=new Point(0,0);
for(int i=0;i<4;i++){
center.x+=points[i].x;
center.y+=points[i].y;
}
center.x/=4;
center.y/=4;
boolean flag=true;
double dist=eculDist(center, points[0]);
for(int i=1;i<4;i++){
double temp=eculDist(center, points[i]);
if(temp!=dist){
sb.append(false).append("\n");
flag=false;
break;
}
}
if(flag){
int counter=0;
for(int i=1;i<4;i++){
if(dotProd(difPoint(points[0], center), difPoint(points[i], center))==0)
counter++;
}
if(counter==2){
sb.append(true).append("\n");
}
else{
sb.append(false).append("\n");
}
}
}
System.out.print(sb);
}
static double eculDist(Point p1,Point p2){
return Math.sqrt(((p1.x-p2.x)*(p1.x-p2.x))+((p1.y-p2.y)*(p1.y-p2.y)));
}
static double dotProd(Point p1,Point p2){
return p1.x*p2.x+p1.y*p2.y;
}
static Point difPoint(Point p1,Point p2){
return new Point(p1.x-p2.x,p1.y-p2.y);
}
static Point parsePoint(String string){
StringBuilder str=new StringBuilder(string);
str.deleteCharAt(0);
if(str.charAt(str.length()-1)==',')
str.deleteCharAt(str.length()-1);
str.deleteCharAt(str.length()-1);
StringTokenizer st2=new StringTokenizer(str.toString(),",");
return new Point(Integer.parseInt(st2.nextToken()),Integer.parseInt(st2.nextToken()));
}
}
class Point{
double x;
double y;
public Point(double x, double y) {
this.x = x;
this.y = y;
}
}
No comments:
Post a Comment