|
|
вернуться в форумjava AC code Послано esbybb 5 окт 2015 01:02 //package timus; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Scanner; public class p1793 { public static void main(String[] args) { InputStream is = System.in; Scanner sc = new Scanner(new InputStreamReader(is)); double a,b,h,r1,r2,R1,R2,H,rr1,rr2,x1,y1,x2,y2,D,d; boolean inside1,inside2; a = sc.nextInt(); b = sc.nextInt(); h = sc.nextInt(); r1 = sc.nextInt(); R1 = sc.nextInt(); r2 = sc.nextInt(); R2 = sc.nextInt(); H = sc.nextInt(); rr1 = R1; rr2 = R2; if (H >= h) { double d1,d2; d1 = (R1-r1)/2.0; d2 = (R2-r2)/2.0; rr1 = 2*d1 * h / H + r1; rr2 = 2*d2 * h / H + r2; } inside1 = 2.0 * rr1 <= a && 2.0 * rr2 <= b; inside2 = 2.0 * rr1 <= b && 2.0 * rr2 <= a; if (!inside1 || !inside2) { System.out.println("NO"); return; } x1 = rr1; y1 = rr1; x2 = a - rr2; y2 = b - rr2; D = R1 + R2; d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); if (d >= D * D) { if ((x2 - x1 + rr1 + rr2) <= a && (y2 - y1 + rr1 + rr2) <= b) System.out.println("YES"); else System.out.println("NO"); } else { System.out.println("NO"); } } } |
|
|