{"id":1272,"date":"2022-06-04T10:03:41","date_gmt":"2022-06-04T02:03:41","guid":{"rendered":"https:\/\/sanlangcode.com\/?p=1272"},"modified":"2022-06-04T10:03:41","modified_gmt":"2022-06-04T02:03:41","slug":"hj87-%e5%af%86%e7%a0%81%e5%bc%ba%e5%ba%a6%e7%ad%89%e7%ba%a7","status":"publish","type":"post","link":"https:\/\/sanlangcode.com\/index.php\/2022\/06\/04\/hj87-%e5%af%86%e7%a0%81%e5%bc%ba%e5%ba%a6%e7%ad%89%e7%ba%a7\/","title":{"rendered":"HJ87 \u5bc6\u7801\u5f3a\u5ea6\u7b49\u7ea7matches()+\u6b63\u5219"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u63cf\u8ff0<\/h2>\n\n\n\n<p>\u5bc6\u7801\u6309\u5982\u4e0b\u89c4\u5219\u8fdb\u884c\u8ba1\u5206\uff0c\u5e76\u6839\u636e\u4e0d\u540c\u7684\u5f97\u5206\u4e3a\u5bc6\u7801\u8fdb\u884c\u5b89\u5168\u7b49\u7ea7\u5212\u5206\u3002<\/p>\n\n\n\n<p>\u4e00\u3001\u5bc6\u7801\u957f\u5ea6:<br>5 \u5206: \u5c0f\u4e8e\u7b49\u4e8e4 \u4e2a\u5b57\u7b26<br>10 \u5206: 5 \u52307 \u5b57\u7b26<br>25 \u5206: \u5927\u4e8e\u7b49\u4e8e8 \u4e2a\u5b57\u7b26<\/p>\n\n\n\n<p>\u4e8c\u3001\u5b57\u6bcd:<br>0 \u5206: \u6ca1\u6709\u5b57\u6bcd<br>10 \u5206: \u5bc6\u7801\u91cc\u7684\u5b57\u6bcd\u5168\u90fd\u662f\u5c0f\uff08\u5927\uff09\u5199\u5b57\u6bcd<br>20 \u5206: \u5bc6\u7801\u91cc\u7684\u5b57\u6bcd\u7b26\u5408\u201d\u5927\u5c0f\u5199\u6df7\u5408\u201c<\/p>\n\n\n\n<p>\u4e09\u3001\u6570\u5b57:<br>0 \u5206: \u6ca1\u6709\u6570\u5b57<br>10 \u5206: 1 \u4e2a\u6570\u5b57<br>20 \u5206: \u5927\u4e8e1 \u4e2a\u6570\u5b57<\/p>\n\n\n\n<p>\u56db\u3001\u7b26\u53f7:<br>0 \u5206: \u6ca1\u6709\u7b26\u53f7<br>10 \u5206: 1 \u4e2a\u7b26\u53f7<br>25 \u5206: \u5927\u4e8e1 \u4e2a\u7b26\u53f7<\/p>\n\n\n\n<p>\u4e94\u3001\u5956\u52b1\uff08\u53ea\u80fd\u9009\u7b26\u5408\u6700\u591a\u7684\u90a3\u4e00\u79cd\u5956\u52b1\uff09:<br>2 \u5206: \u5b57\u6bcd\u548c\u6570\u5b57<br>3 \u5206: \u5b57\u6bcd\u3001\u6570\u5b57\u548c\u7b26\u53f7<br>5 \u5206: \u5927\u5c0f\u5199\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u7b26\u53f7<br>\u6700\u540e\u7684\u8bc4\u5206\u6807\u51c6:<br>&gt;= 90: \u975e\u5e38\u5b89\u5168<br>&gt;= 80: \u5b89\u5168\uff08Secure\uff09<br>&gt;= 70: \u975e\u5e38\u5f3a<br>&gt;= 60: \u5f3a\uff08Strong\uff09<br>&gt;= 50: \u4e00\u822c\uff08Average\uff09<br>&gt;= 25: \u5f31\uff08Weak\uff09<br>&gt;= 0:&nbsp; \u975e\u5e38\u5f31\uff08Very_Weak\uff09<\/p>\n\n\n\n<p>\u5bf9\u5e94\u8f93\u51fa\u4e3a\uff1a<\/p>\n\n\n\n<p>VERY_SECURE<br>SECURE<br>VERY_STRONG<br>STRONG<br>AVERAGE<br>WEAK<br>VERY_WEAK<\/p>\n\n\n\n<p>\u8bf7\u6839\u636e\u8f93\u5165\u7684\u5bc6\u7801\u5b57\u7b26\u4e32\uff0c\u8fdb\u884c\u5b89\u5168\u8bc4\u5b9a\u3002<\/p>\n\n\n\n<p>\u6ce8\uff1a<br>\u5b57\u6bcd\uff1aa-z, A-Z<br>\u6570\u5b57\uff1a0-9<br>\u7b26\u53f7\u5305\u542b\u5982\u4e0b\uff1a (ASCII\u7801\u8868\u53ef\u4ee5\u5728UltraEdit\u7684\u83dc\u5355view-&gt;ASCII Table\u67e5\u770b)<br>!&#8221;#$%&amp;'()*+,-.\/&nbsp; &nbsp; &nbsp;(ASCII\u7801\uff1a0x21~0x2F)<br>:;&lt;=&gt;?@&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(ASCII\u7801\uff1a0x3A~0x40)<br>[\\]^_`&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (ASCII\u7801\uff1a0x5B~0x60)<br>{|}~&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (ASCII\u7801\uff1a0x7B~0x7E)<\/p>\n\n\n\n<p>\u63d0\u793a:<br>1 &lt;= \u5b57\u7b26\u4e32\u7684\u957f\u5ea6&lt;= 300<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8f93\u5165\u63cf\u8ff0\uff1a<\/h3>\n\n\n\n<p>\u8f93\u5165\u4e00\u4e2astring\u7684\u5bc6\u7801<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8f93\u51fa\u63cf\u8ff0\uff1a<\/h3>\n\n\n\n<p>\u8f93\u51fa\u5bc6\u7801\u7b49\u7ea7<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u793a\u4f8b1<\/h2>\n\n\n\n<p>\u8f93\u5165\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">38$@NoNoN\n<\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">VERY_SECURE\n<\/pre>\n\n\n\n<p>\u8bf4\u660e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u6837\u4f8b\u7684\u5bc6\u7801\u957f\u5ea6\u5927\u4e8e\u7b49\u4e8e8\u4e2a\u5b57\u7b26\uff0c\u5f9725\u5206\uff1b\u5927\u5c0f\u5199\u5b57\u6bcd\u90fd\u6709\u6240\u4ee5\u5f9720\u5206\uff1b\u6709\u4e24\u4e2a\u6570\u5b57\uff0c\u6240\u4ee5\u5f9720\u5206\uff1b\u5305\u542b\u5927\u4e8e1\u7b26\u53f7\uff0c\u6240\u4ee5\u5f9725\u5206\uff1b\u7531\u4e8e\u8be5\u5bc6\u7801\u5305\u542b\u5927\u5c0f\u5199\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u7b26\u53f7\uff0c\u6240\u4ee5\u5956\u52b1\u90e8\u5206\u5f975\u5206\uff0c\u7ecf\u7edf\u8ba1\u5f97\u8be5\u5bc6\u7801\u7684\u5bc6\u7801\u5f3a\u5ea6\u4e3a25+20+20+25+5=95\u5206\u3002\n         <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u793a\u4f8b2<\/h2>\n\n\n\n<p>\u8f93\u5165\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Jl)M:+<\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">AVERAGE<\/pre>\n\n\n\n<p>\u8bf4\u660e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u793a\u4f8b2\u7684\u5bc6\u7801\u5f3a\u5ea6\u4e3a10+20+0+25+0=55\u5206\u3002<\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>import java.util.Scanner;\n\npublic class Main {\n\n    public static void main(String&#91;] args) {\n        Scanner sc = new Scanner(System.in);\n        while (sc.hasNext()) {\n            String input = sc.nextLine();\n            int score = 0;\n            if (input.length() &lt;= 4) {\n                score += 5;\n            } else if (input.length() &lt; 8) {\n                score += 10;\n            } else {\n                score += 25;\n            }\n            if (input.matches(\".*&#91;A-Za-z]+.*\")) {\n                if (input.matches(\".*&#91;A-Z].*\")\n                        &amp;&amp; input.matches(\".*&#91;a-z].*\")) {\n                    score += 20;\n                } else {\n                    score += 10;\n                }\n            }\n            if (input.matches(\".*&#91;0-9]+.*\")) {\n                if (input.matches(\".*&#91;0-9].*&#91;0-9].*\")) {\n                    score += 20;\n                } else {\n                    score += 10;\n                }\n            }\n            if (input.matches(\".*&#91;^A-Za-z0-9]+.*\")) {\n                if (input.matches(\".*&#91;^A-Za-z0-9].*&#91;^A-Za-z0-9].*\")) {\n                    score += 25;\n                } else {\n                    score += 10;\n                }\n            }\n            if (input.matches(\".*&#91;0-9]+.*\")) {\n                if (input.matches(\".*&#91;A-Z].*\")\n                        &amp;&amp; input.matches(\".*&#91;a-z].*\")\n                        &amp;&amp; input.matches(\".*&#91;^A-Za-z0-9]+.*\")) {\n                    score += 5;\n                } else if (input.matches(\".*&#91;A-Za-z]+.*\")) {\n                    if (input.matches(\".*&#91;^A-Za-z0-9]+.*\")) {\n                        score += 3;\n                    } else {\n                        score += 2;\n                    }\n                }\n            }\n            if (score >= 90) {\n                System.out.println(\"VERY_SECURE\");\n            } else if (score >= 80) {\n                System.out.println(\"SECURE\");\n            } else if (score >= 70) {\n                System.out.println(\"VERY_STRONG\");\n            } else if (score >= 60) {\n                System.out.println(\"STRONG\");\n            } else if (score >= 50) {\n                System.out.println(\"AVERAGE\");\n            } else if (score >= 25) {\n                System.out.println(\"WEAK\");\n            } else {\n                System.out.println(\"VERY_WEAK\");\n            }\n        }\n        sc.close();\n    }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u63cf\u8ff0 \u5bc6\u7801\u6309\u5982\u4e0b\u89c4\u5219\u8fdb\u884c\u8ba1\u5206\uff0c\u5e76&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":1122,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1272","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-4"],"_links":{"self":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/1272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/comments?post=1272"}],"version-history":[{"count":0,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/1272\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/media\/1122"}],"wp:attachment":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/media?parent=1272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/categories?post=1272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/tags?post=1272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}