{"id":3142,"date":"2023-10-20T10:40:56","date_gmt":"2023-10-20T02:40:56","guid":{"rendered":"https:\/\/white-night.club\/?p=3142"},"modified":"2024-02-29T09:34:03","modified_gmt":"2024-02-29T01:34:03","slug":"ad77","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/20\/ad77\/","title":{"rendered":"2525.\u00a0\u6839\u636e\u89c4\u5219\u5c06\u7bb1\u5b50\u5206\u7c7b"},"content":{"rendered":"\n<p>\u7ed9\u4f60\u56db\u4e2a\u6574\u6570&nbsp;<code>length<\/code>&nbsp;\uff0c<code>width<\/code>&nbsp;\uff0c<code>height<\/code>&nbsp;\u548c&nbsp;<code>mass<\/code>&nbsp;\uff0c\u5206\u522b\u8868\u793a\u4e00\u4e2a\u7bb1\u5b50\u7684\u4e09\u4e2a\u7ef4\u5ea6\u548c\u8d28\u91cf\uff0c\u8bf7\u4f60\u8fd4\u56de\u4e00\u4e2a\u8868\u793a\u7bb1\u5b50&nbsp;<strong>\u7c7b\u522b<\/strong>&nbsp;\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n\n\n\n<ul>\n<li>\u5982\u679c\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6\uff0c\u90a3\u4e48\u7bb1\u5b50\u662f&nbsp;<code>\"Bulky\"<\/code>&nbsp;\u7684\uff1a\n<ul>\n<li>\u7bb1\u5b50&nbsp;<strong>\u81f3\u5c11\u6709\u4e00\u4e2a<\/strong>&nbsp;\u7ef4\u5ea6\u5927\u4e8e\u7b49\u4e8e&nbsp;<code>10<sup>4<\/sup><\/code>&nbsp;\u3002<\/li>\n\n\n\n<li>\u6216\u8005\u7bb1\u5b50\u7684&nbsp;<strong>\u4f53\u79ef<\/strong>&nbsp;\u5927\u4e8e\u7b49\u4e8e&nbsp;<code>10<sup>9<\/sup><\/code>&nbsp;\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5982\u679c\u7bb1\u5b50\u7684\u8d28\u91cf\u5927\u4e8e\u7b49\u4e8e&nbsp;<code>100<\/code>&nbsp;\uff0c\u90a3\u4e48\u7bb1\u5b50\u662f&nbsp;<code>\"Heavy\"<\/code>&nbsp;\u7684\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u7bb1\u5b50\u540c\u65f6\u662f&nbsp;<code>\"Bulky\"<\/code>&nbsp;\u548c&nbsp;<code>\"Heavy\"<\/code>&nbsp;\uff0c\u90a3\u4e48\u8fd4\u56de\u7c7b\u522b\u4e3a&nbsp;<code>\"Both\"<\/code>&nbsp;\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u7bb1\u5b50\u65e2\u4e0d\u662f&nbsp;<code>\"Bulky\"<\/code>&nbsp;\uff0c\u4e5f\u4e0d\u662f&nbsp;<code>\"Heavy\"<\/code>&nbsp;\uff0c\u90a3\u4e48\u8fd4\u56de\u7c7b\u522b\u4e3a&nbsp;<code>\"Neither\"<\/code>&nbsp;\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u7bb1\u5b50\u662f&nbsp;<code>\"Bulky\"<\/code>&nbsp;\u4f46\u4e0d\u662f&nbsp;<code>\"Heavy\"<\/code>&nbsp;\uff0c\u90a3\u4e48\u8fd4\u56de\u7c7b\u522b\u4e3a&nbsp;<code>\"Bulky\"<\/code>&nbsp;\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u7bb1\u5b50\u662f&nbsp;<code>\"Heavy\"<\/code>&nbsp;\u4f46\u4e0d\u662f&nbsp;<code>\"Bulky\"<\/code>&nbsp;\uff0c\u90a3\u4e48\u8fd4\u56de\u7c7b\u522b\u4e3a&nbsp;<code>\"Heavy\"<\/code>&nbsp;\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u6ce8\u610f<\/strong>\uff0c\u7bb1\u5b50\u7684\u4f53\u79ef\u7b49\u4e8e\u7bb1\u5b50\u7684\u957f\u5ea6\u3001\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u7684\u4e58\u79ef\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>length = 1000, width = 35, height = 700, mass = 300\n<strong>\u8f93\u51fa\uff1a<\/strong>\"Heavy\"\n<strong>\u89e3\u91ca\uff1a<\/strong>\n\u7bb1\u5b50\u6ca1\u6709\u4efb\u4f55\u7ef4\u5ea6\u5927\u4e8e\u7b49\u4e8e 10<sup>4 <\/sup>\u3002\n\u4f53\u79ef\u4e3a 24500000 &lt;= 10<sup>9 <\/sup>\u3002\u6240\u4ee5\u4e0d\u80fd\u5f52\u7c7b\u4e3a \"Bulky\" \u3002\n\u4f46\u662f\u8d28\u91cf &gt;= 100 \uff0c\u6240\u4ee5\u7bb1\u5b50\u662f \"Heavy\" \u7684\u3002\n\u7531\u4e8e\u7bb1\u5b50\u4e0d\u662f \"Bulky\" \u4f46\u662f\u662f \"Heavy\" \uff0c\u6240\u4ee5\u6211\u4eec\u8fd4\u56de \"Heavy\" \u3002<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>length = 200, width = 50, height = 800, mass = 50\n<strong>\u8f93\u51fa\uff1a<\/strong>\"Neither\"\n<strong>\u89e3\u91ca\uff1a<\/strong>\n\u7bb1\u5b50\u6ca1\u6709\u4efb\u4f55\u7ef4\u5ea6\u5927\u4e8e\u7b49\u4e8e 10<sup>4<\/sup>&nbsp;\u3002\n\u4f53\u79ef\u4e3a 8 * 10<sup>6<\/sup> &lt;= 10<sup>9<\/sup>&nbsp;\u3002\u6240\u4ee5\u4e0d\u80fd\u5f52\u7c7b\u4e3a \"Bulky\" \u3002\n\u8d28\u91cf\u5c0f\u4e8e 100 \uff0c\u6240\u4ee5\u4e0d\u80fd\u5f52\u7c7b\u4e3a \"Heavy\" \u3002\n\u7531\u4e8e\u4e0d\u5c5e\u4e8e\u4e0a\u8ff0\u4e24\u8005\u4efb\u4f55\u4e00\u7c7b\uff0c\u6240\u4ee5\u6211\u4eec\u8fd4\u56de \"Neither\" \u3002<\/pre>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul>\n<li><code>1 &lt;= length, width, height &lt;= 10<sup>5<\/sup><\/code><\/li>\n\n\n\n<li><code>1 &lt;= mass &lt;= 10<sup>3<\/sup><\/code><\/li>\n<\/ul>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>if<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u6ca1\u5565\u597d\u8bb0\u5f55\u7684\uff0c\u5355\u7eaf\u5c31\u662fif\u6761\u4ef6\u5224\u65ad\u3002\u4e0d\u8fc7\u957f\u5bbd\u9ad8\u5176\u4e2d\u4e24\u4e2a\u76f8\u4e58\u6709\u53ef\u80fd\u4f1a\u6ea2\u51fa\uff0c\u76ee\u524d\u6211\u53ea\u60f3\u5230\u7528long long\u53bb\u63a5\u6536\u5927\u6570\uff0c\u6682\u65f6\u6ca1\u60f3\u5230\u6709\u6ca1\u6709\u4f18\u5316\u7684\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p>return\u7684\u8bdd\u4e3a\u4e86\u5c11\u5199\u51e0\u4e2aelse\u8bed\u53e5\uff0c\u7528\u4e86\u4e09\u76ee\u8fd0\u7b97\u7b26\u201c?\u201d\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">C++<\/span><span role=\"button\" tabindex=\"0\" data-code=\"class Solution {\npublic:\n    string categorizeBox(int length, int width, int height, int mass) {\n        int bulky=0,heavy=0;\n        if(length&gt;=10000||width&gt;=10000||height&gt;=10000)\n        {\n             bulky=1;\n        }else{\n            long long v=length;\n            v*=width;v*=height;\n            if(v&gt;=1000000000)\n            {\n                bulky=1;\n            }\n        }\n        if(mass&gt;=100)\n        {\n            heavy=1;\n        }\n        if(bulky==heavy)\n        {\n            return bulky==1?&quot;Both&quot;:&quot;Neither&quot;;\n        }else\n        {\n            return bulky==1?&quot;Bulky&quot;:&quot;Heavy&quot;;\n        }\n    }\n};\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Solution<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">public:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #4EC9B0\">string<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">categorizeBox<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">int<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">length<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #569CD6\">int<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">width<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #569CD6\">int<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">height<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #569CD6\">int<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">mass<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #569CD6\">int<\/span><span style=\"color: #D4D4D4\"> bulky=<\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">,heavy=<\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\">(length&gt;=<\/span><span style=\"color: #B5CEA8\">10000<\/span><span style=\"color: #D4D4D4\">||width&gt;=<\/span><span style=\"color: #B5CEA8\">10000<\/span><span style=\"color: #D4D4D4\">||height&gt;=<\/span><span style=\"color: #B5CEA8\">10000<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">             bulky=<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        }<\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #569CD6\">long<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">long<\/span><span style=\"color: #D4D4D4\"> v=length;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            v*=width;v*=height;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\">(v&gt;=<\/span><span style=\"color: #B5CEA8\">1000000000<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                bulky=<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\">(mass&gt;=<\/span><span style=\"color: #B5CEA8\">100<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            heavy=<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\">(bulky==heavy)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> bulky==<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">?<\/span><span style=\"color: #CE9178\">&quot;Both&quot;<\/span><span style=\"color: #D4D4D4\">:<\/span><span style=\"color: #CE9178\">&quot;Neither&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        }<\/span><span style=\"color: #C586C0\">else<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> bulky==<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">?<\/span><span style=\"color: #CE9178\">&quot;Bulky&quot;<\/span><span style=\"color: #D4D4D4\">:<\/span><span style=\"color: #CE9178\">&quot;Heavy&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">};<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u6478\u9c7c\u9898<\/p>\n","protected":false},"author":1,"featured_media":2827,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[42,25],"tags":[38],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3142"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=3142"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3142\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2827"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=3142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}