18信科2龚思佳


私信TA

用户名:uq_33103784766

访问量:16416

签 名:

等  级
排  名 206
经  验 6261
参赛次数 7
文章发表 121
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

import java.text.DecimalFormat;

import java.util.Scanner;


public class Main {

@SuppressWarnings("null")

public static void main(String[] args){

double[] x = new double[4];

double[] y = new double[4];

double[] x1 = new double[4];

double[] y1 = new double[4];

DecimalFormat df = new DecimalFormat("0.00");

Scanner scanner=new Scanner(System.in);

for(int i=0;i<4;i++) {

x[i]=scanner.nextDouble();

y[i]=scanner.nextDouble();

}

x1[0]=Math.max(Math.min(x[0], x[1]), Math.min(x[2], x[3]));

x1[1]=Math.min(Math.max(x[0], x[1]), Math.max(x[2], x[3]));

y1[0]=Math.min(Math.max(y[0], y[1]), Math.max(y[2], y[3]));

y1[1]=Math.max(Math.min(y[0], y[1]), Math.min(y[2], y[3]));

if(x1[1]>x1[0]&&y1[0]>y1[1])

System.out.print(df.format((x1[1]-x1[0])*(y1[0]-y1[1])));

else

System.out.print(df.format(0));

}

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区