UVa_1587 - Box

本文介绍了一个程序,用于判断给定的六对面的长和宽是否能组成一个长方体盒子。通过排序和验证特定条件,程序能够准确判断是否可以成功组装长方体,并提供可能性结果。

ooden boxes of different sizesto pack machinery for delivery to the customers. Each boxis a rectangular parallelepiped. Ivan uses six rectangular wooden palletsto make a box. Each pallet is used for one side of the box.

\epsfbox{p3214.eps}

Joe delivers pallets for Ivan. Joe is not very smart andoften makes mistakes -- he brings Ivan pallets that do not fittogether to make a box. But Joe does not trust Ivan. It alwaystakes a lot of time to explain Joe that he has made a mistake.Fortunately, Joe adores everything related to computers and sincerelybelieves that computers never make mistakes. Ivan has decided touse this for his own advantage. Ivan asks you to writea program that given sizes of six rectangular palletstells whether it is possible to make a box out of them.

Input 

Input file contains several test cases. Each of them consists of six lines. Each line describes one pallet andcontains two integer numbersw and h (1$ \le$w,h$ \le$10 000) --width and height of the pallet in millimeters respectively.

Output 

For each test case, print one output line. Write a single word `POSSIBLE' to the output file if it is possibleto make a box using six given pallets for its sides. Write a single word`IMPOSSIBLE' if it is not possible to do so.

Sample Input 


1345 2584
2584 683
2584 1345
683 1345
683 1345
2584 683
1234 4567
1234 4567
4567 4321
4322 4567
4321 1234
4321 1234


Sample Output 


POSSIBLE
IMPOSSIBLE

题意:

给定6对面的长和宽,判定是否可以组成长方体

解题:

1. 设长方体的长,宽,高分别为a,b,c(a<=b<=c),那么满足以下条件的话,就是长方体;

a b

a b

a c

a c

b c

b c

2. 本题的思路就是首先排序,对于6行2列的数据,保证横竖都从小到大,然后判定是否满足上述的长方体的格式即可

代码如下:

 

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

struct node
{
    int h,w;
    bool operator < (const node& r) const { return h<r.h || h==r.h&&w<r.w; }
}r[7];

bool read()
{
    memset(r,0,sizeof(r));
    while(cin>>r[0].h>>r[0].w)
    {
        if(r[0].h>r[0].w) swap(r[0].h,r[0].w);
        for(int i=1;i<6;i++) { cin>>r[i].h>>r[i].w; if(r[i].h>r[i].w) swap(r[i].h,r[i].w);}
        return true;
    }
    return false;
}

bool Is_box()
{
    if(r[0].h!=r[1].h || r[0].w!=r[1].w) return false;
    if(r[2].h!=r[3].h || r[2].w!=r[3].w) return false;
    if(r[4].h!=r[5].h || r[4].w!=r[5].w) return false;
    if(r[0].h!=r[2].h) return false;
    if(r[0].w!=r[4].h) return false;
    if(r[2].w!=r[4].w) return false;
    return true;
}

int main()
{
    //freopen("1587.txt","r",stdin);
    while(read())
    {
        sort(r,r+6);
        if(Is_box()) cout<<"POSSIBLE"<<endl;
        else cout<<"IMPOSSIBLE"<<endl;
    }
    return 0;
}




内容概要:本文档围绕六自由度机械臂的ANN人工神经网络设计展开,涵盖正向与逆向运动学求解、正向动力学控制,并采用拉格朗日-欧拉法推导逆向动力学方程,所有内容均通过Matlab代码实现。同时结合RRT路径规划与B样条优化技术,提升机械臂运动轨迹的合理性与平滑性。文中还涉及多种先进算法与仿真技术的应用,如状态估计中的UKF、AUKF、EKF等滤波方法,以及PINN、INN、CNN-LSTM等神经网络模型在工程问题中的建模与求解,展示了Matlab在机器人控制、智能算法与系统仿真中的强大能力。; 适合人群:具备一定Ma六自由度机械臂ANN人工神经网络设计:正向逆向运动学求解、正向动力学控制、拉格朗日-欧拉法推导逆向动力学方程(Matlab代码实现)tlab编程基础,从事机器人控制、自动化、智能制造、人工智能等相关领域的科研人员及研究生;熟悉运动学、动力学建模或对神经网络在控制系统中应用感兴趣的工程技术人员。; 使用场景及目标:①实现六自由度机械臂的精确运动学与动力学建模;②利用人工神经网络解决传统解析方法难以处理的非线性控制问题;③结合路径规划与轨迹优化提升机械臂作业效率;④掌握基于Matlab的状态估计、数据融合与智能算法仿真方法; 阅读建议:建议结合提供的Matlab代码进行实践操作,重点理解运动学建模与神经网络控制的设计流程,关注算法实现细节与仿真结果分析,同时参考文中提及的多种优化与估计方法拓展研究思路。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值