{"id":67,"date":"2023-06-25T22:34:49","date_gmt":"2023-06-25T14:34:49","guid":{"rendered":"https:\/\/bh4bqi.cn\/?p=67"},"modified":"2023-06-25T22:34:49","modified_gmt":"2023-06-25T14:34:49","slug":"%e6%b0%b8%e6%81%92%e7%9a%84%e7%94%9f%e5%91%bd%e6%b8%b8%e6%88%8f","status":"publish","type":"post","link":"https:\/\/bh4bqi.cn\/?p=67","title":{"rendered":"\u6c38\u6052\u7684\u751f\u547d\u6e38\u620f"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><\/p>\n<cite>https:\/\/iai.sh.cn\/problem\/42<\/cite><\/blockquote>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\" style=\"border-width:7px;margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20);padding-top:var(--wp--preset--spacing--20);padding-right:var(--wp--preset--spacing--20);padding-bottom:var(--wp--preset--spacing--20);padding-left:var(--wp--preset--spacing--20)\"><code>#include &lt;iostream>\n#include &lt;vector>\nusing namespace std;\n\nint main()\n{\n\n    int row = 0, col = 0;\n    char chStarPoint&#91;3];\n    bool blStill = true;\n\n    chStarPoint&#91;1] = '*';\n    chStarPoint&#91;2] = '.';\n\n    cin >> row;\n    cin >> col;\n    string strRow;\n\n    vector&lt;vector&lt;unsigned char>> c(row + 1);\n    vector&lt;vector&lt;unsigned char>> n(row + 1);\n\n    for (int i = 0; i &lt;= row; i++)\n    {\n        c&#91;i].resize(col + 1);\n        n&#91;i].resize(col + 1);\n    }\n\n    \/\/ set use the cin to update the mine matrix\n    for (int i = 0; i &lt; row; i++)\n    {\n        cin >> strRow;\n        for (int k = 0; k &lt; col; k++)\n        {\n            c&#91;i]&#91;k] = strRow&#91;k];\n        }\n    }\n\n    for (int i = 0; i &lt; row; i++)\n    {\n        for (int k = 0; k &lt; col; k++)\n        {\n\n            int countStar = 0;\n            \/\/ column -1\n            if ((i > 0 and k > 0) and c&#91;i - 1]&#91;k - 1] == chStarPoint&#91;1])\n                countStar++;\n            if ((k > 0) and c&#91;i]&#91;k - 1] == chStarPoint&#91;1])\n                countStar++;\n            if ((k > 0) and c&#91;i + 1]&#91;k - 1] == chStarPoint&#91;1])\n                countStar++;\n\n            \/\/ column 0\n            if ((i > 0) and c&#91;i - 1]&#91;k] == chStarPoint&#91;1])\n                countStar++;\n\n            \/\/ if (chDetail&#91;i]&#91;k] == chStarPoint&#91;1]) countStar++; \/\/just keep format, no use\n            if (c&#91;i + 1]&#91;k] == chStarPoint&#91;1])\n                countStar++;\n            \/\/ column +1\n\n            if ((i > 0) and c&#91;i - 1]&#91;k + 1] == chStarPoint&#91;1])\n                countStar++;\n            if (c&#91;i]&#91;k + 1] == chStarPoint&#91;1])\n                countStar++;\n            if (c&#91;i + 1]&#91;k + 1] == chStarPoint&#91;1])\n                countStar++;\n\n            switch (c&#91;i]&#91;k])\n            {\n            case '.':\n                if (countStar == 3)\n                {\n                    n&#91;i]&#91;k] = chStarPoint&#91;1];\n                }\n                else\n                {\n                    n&#91;i]&#91;k] = chStarPoint&#91;2];\n                }\n                break;\n            case '*':\n                if ((countStar == 2) or (countStar == 3))\n                {\n                    n&#91;i]&#91;k] = chStarPoint&#91;1];\n                }\n                else\n                {\n                    n&#91;i]&#91;k] = chStarPoint&#91;2];\n                };\n                break;\n            }\n        }\n    }\n\n    for (int i = 0; i &lt; row; i++)\n    {\n        for (int k = 0; k &lt; col; k++)\n        {\n            if (c&#91;i]&#91;k] != n&#91;i]&#91;k])\n                blStill = false;\n        }\n    }\n\n    if (blStill)\n    {\n        cout &lt;&lt; \"Still life\" &lt;&lt; endl;\n    }\n    else\n    {\n        cout &lt;&lt; \"Other\" &lt;&lt; endl;\n    }\n\n    return 0;\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/iai.sh.cn\/problem\/42<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-67","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/bh4bqi.cn\/index.php?rest_route=\/wp\/v2\/posts\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bh4bqi.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bh4bqi.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bh4bqi.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bh4bqi.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=67"}],"version-history":[{"count":1,"href":"https:\/\/bh4bqi.cn\/index.php?rest_route=\/wp\/v2\/posts\/67\/revisions"}],"predecessor-version":[{"id":68,"href":"https:\/\/bh4bqi.cn\/index.php?rest_route=\/wp\/v2\/posts\/67\/revisions\/68"}],"wp:attachment":[{"href":"https:\/\/bh4bqi.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bh4bqi.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bh4bqi.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}