2023每日刷题(五)
Leetcode—2525.根据规则将箱子分类
实现代码
char * categorizeBox(int length, int width, int height, int mass){
long long volume;
long long len = (long long)length;
long long wid = (long long)width;
long long heig = (long long)height;
volume = len * wid * heig;
int flagb = 0, flagh = 0;
if((length >= 1e4 || width >= 1e4 || height >= 1e4) || (volume >= 1e9)) {
flagb = 1;
}
if(mass >= 100) {
flagh = 1;
}
if(flagb && flagh) {
return "Both";
} else if(flagb == 0 && flagh == 0) {
return "Neither";
} else if(flagb == 1 && flagh == 0) {
return "Bulky";
} else {
return "Heavy";
}
}
测试结果
之后我会持续更新,如果喜欢我的文章,请记得一键三连哦,点赞关注收藏,你的每一个赞每一份关注每一次收藏都将是我前进路上的无限动力 !!!↖(▔▽▔)↗感谢支持!