标签:sys alt imp system import http png double 技术分享
-------------------------------------------------------------------------------------------
思路见锦囊2
-------------------------------------------------------------------------------------------
算法
1 import java.util.Scanner; 2 public class Main { 3 public static void main(String[] args) { 4 Scanner sc = new Scanner(System.in); 5 double[] x = new double[4]; 6 double[] y = new double[4]; 7 double[] z = new double[4]; 8 for(int i=0;i<4;i++){ 9 x[i] = sc.nextDouble(); 10 y[i] = sc.nextDouble(); 11 } 12 z[0] = Math.max(Math.min(x[0], x[1]),Math.min(x[2], x[3])); //x1 13 z[1] = Math.min(Math.max(x[0], x[1]),Math.max(x[2], x[3])); //x2 14 15 z[2] = Math.max(Math.min(y[0], y[1]),Math.min(y[2], y[3])); //y1 16 z[3] = Math.min(Math.max(y[0], y[1]),Math.max(y[2], y[3])); //y2 17 if(z[0]<z[1]&&z[2]<z[3]) 18 System.out.printf("%.2f\n",(z[1]-z[0])*(z[3]-z[2])); 19 else 20 System.out.println("0.00"); 21 } 22 }
标签:sys alt imp system import http png double 技术分享
原文地址:http://www.cnblogs.com/loveluking/p/6102462.html