import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { int x1,x2,x3,y1,y2,y3,x0,y0; int R, 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) 回帖