矩面积交.边界大数.矩阵冲突.C

 


#标准化矩阵和数据类型选择

acode

void MMN() {

    double x1, y1, x2, y2;
    double a1, b1, a2, b2;

    // Read the coordinates of the first rectangle
    scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);

    // Read the coordinates of the second rectangle
    scanf("%lf%lf%lf%lf", &a1, &b1, &a2, &b2);

    // Check if the two rectangles are colliding
    double x = x1 < x2 ? x1 : x2;//sma
    double X = x1 > x2 ? x1 : x2;//big
    double y = y1 < y2 ? y1 : y2;//sma
    double Y = y1 > y2 ? y1 : y2;//big  //(x,y)&(X,Y)
    double a = a1 < a2 ? a1 : a2;//s
    double A = a1 > a2 ? a1 : a2;//b
    double b = b1 < b2 ? b1 : b2;//s
    double B = b1 > b2 ? b1 : b2;//b   //(a,b)&(A,B)


    if (x < A && X > a && y < B && Y > b) {
        //printf("YES\n");
        double xX[4] = {x, X, a, A};
        bubble_sort(xX, 4);
        double yy[4] = {y, Y, b, B};
        bubble_sort(yy, 4);

        printf("%.2f", (xX[2] - xX[1]) * (yy[2] - yy[1]));
    } else {
        printf("0.00");nonono
    }
}

I'm taken by a nursery rhyme

I want to make a ray of sunshine and never leave home

No amount of coffee

No amount of crying

No amount of whiskey

No amount of wine

No No No No No

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值