왜 WA일까요

soda5874 Reply 7 years 9 weeks ago
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); double a,b,c,d,e,f,D,x,y,x1,x2,x3,x4,y1,y2,y3,y4; x1=sc.nextDouble(); y1=sc.nextDouble(); x2=sc.nextDouble(); y2=sc.nextDouble(); x3=sc.nextDouble(); y3=sc.nextDouble(); x4=sc.nextDouble(); y4=sc.nextDouble(); a=y1-y2; b=(-1)*(x1-x2); e=(y1-y2)*x1-(x1-x2)*y1; c=y3-y4; d=(-1)*(x3-x4); f=(y3-y4)*x3-(x3-x4)*y3; D=a*d-b*c; if(a/b==c/d) { System.out.println("parallel"); } else { x=(e*d-b*f)/D; y=(a*f-e*c)/D; x=(double)((int)(x*10)/10); y=(double)((int)(y*10)/10); System.out.printf("%.1f %.1f",x,y); } } }
withcs1 Reply 7 years 9 weeks ago
축하해요~