版权声明:本人菜鸟一只,如文章有错误或您有高见,请不吝赐教 https://blog.csdn.net/qq_41138935/article/details/82667991
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int MAX=7;
int w[MAX]; //长
int h[MAX]; //宽
bool compare(int a,int b){
return a>b;
}
int main(){
int temp;
for(int i=1;i<MAX;i++){
cin>>w[i]>>h[i];
if(h[i]>w[i]){
temp=w[i];
w[i]=h[i];
h[i]=temp;
}
}
sort(w+1,w+7,compare);
sort(h+1,h+7,compare);
if(w[1]==w[4]&&w[5]==w[6]&&w[6]==h[2]&&h[3]==h[6]){
cout<<"能构成长方体的六个面!"<<endl;
}else{
cout<<"不能!"<<endl;
}
//上下前后两侧
// for(int i=1;i<MAX;i++){
// cout<<w[i]<<"\t"<<h[i]<<endl;
// }
return 0;
}
按长*宽 由大到小排序,判断各棱长。