import java.util.Scanner; import java.lang.Math; public class Main{ public static void main(String[] args){ int x1,x2,x3,y1,y2,y3,x0,y0,R; int damage=0; Scanner sc = new Scanner(System.in); R = sc.nextInt(); x1 = sc.nextInt(); y1 = sc.nextInt(); x2 = sc.nextInt(); y2 = sc.nextInt(); x3 = sc.nextInt(); y3 = sc.nextInt(); x0 = sc.nextInt(); y0 = sc.nextInt(); damage = ( Math.pow((x1>x0)? x1-x0:x0-x1, 2) + Math.pow((y1>y0)? y1-y0:y0-y1, 2)<=R*R)? damage+1:damage; damage = ( Math.pow((x2>x0)? x2-x0:x0-x2, 2) + Math.pow((y2>y0)? y2-y0:y0-y2, 2)<=R*R)? damage+1:damage; damage = ( Math.pow((x3>x0)? x3-x0:x0-x3, 2) + Math.pow((y3>y0)? y3-y0:y0-y3, 2)<=R*R)? damage+1:damage; System.out.println(damage + "x"); } }
这一道题,为啥我的代码会没有输出的??我用eclipse运行没问题啊。
全部评论
(0) 回帖