{"id":526,"date":"2024-06-02T09:00:00","date_gmt":"2024-06-02T01:00:00","guid":{"rendered":"https:\/\/seanxd.com\/?p=526"},"modified":"2024-06-02T10:55:42","modified_gmt":"2024-06-02T02:55:42","slug":"zerojudge-a624","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-a624\/","title":{"rendered":"ZeroJudge A624: Password Analyzer"},"content":{"rendered":"\n\n\n<p class=\"\">\u4f60\u5728\u4e00\u5bb6\u6210\u9577\u4e2d\u7684\u96fb\u5b50\u5546\u52d9\u7db2\u7ad9\u5de5\u4f5c\uff0c\u800c\u5b83\u4e5f\u6210\u4e86\u7aca\u8cca\u89ac\u89a6\u7684\u5c0d\u8c61\u3002\u7aca\u8cca\u4ee5\u731c\u6e2c\u5bc6\u78bc\u7684\u65b9\u5f0f\u4f86\u5b58\u53d6\u9867\u5ba2\u7684\u5e33\u865f\uff0c\u9019\u5e38\u5e38\u662f\u8f15\u800c\u6613\u8209\u7684 (\u5982\u300csecret\u300d\u3001\u300cpassword\u300d\u3001\u548c\u300c1234\u300d)\u3002\u5982\u679c\u4f60\u7684\u9867\u5ba2\u4f7f\u7528\u8f03\u597d\u7684\u5bc6\u78bc\uff0c\u4f60\u7684\u516c\u53f8\u5c31\u53ef\u4ee5\u7701\u9ede\u529b\u6c23\u4f86\u8655\u7406\u76dc\u5237\u7684\u554f\u984c\u3002<\/p>\n\n\n\n<p class=\"\">\u4f60\u88ab\u8ce6\u8207\u7684\u4efb\u52d9\u70ba\u8a2d\u8a08\u4e00\u500b\u5bc6\u78bc\u5206\u6790\u5668\u4ee5\u544a\u77e5\u9867\u5ba2\u4ed6\u5011\u6240\u9078\u7684\u5bc6\u78bc\u7684\u5f37\u5ea6\u3002\u4e00\u500b\u300c\u5f37\u300d\u5bc6\u78bc\u4ee5\u589e\u52a0\u9577\u5ea6\u6216\u6df7\u7528\u5b57\u6bcd\u3001\u6578\u5b57\u53ca\u7b26\u865f\u4f86\u589e\u52a0\u731c\u6e2c\u7684\u96e3\u5ea6\u3002\u5728\u9019\u9805\u5de5\u4f5c\u4e2d\uff0c\u4e00\u500b\u300c\u5f37\u300d(Strong) \u5bc6\u78bc\u64c1\u6709\u4ee5\u4e0b\u6240\u6709\u7279\u6027\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"\">\u9577\u5ea6<strong>\u81f3\u5c11 8 \u500b\u5b57\u5143<\/strong> (\u5982\uff1a\u300cspookyfish\u300d)<\/li>\n\n\n\n<li class=\"\">\u540c\u6642<strong>\u6709\u5927\u5beb\u53ca\u5c0f\u5beb<\/strong>\u5b57\u6bcd (\u5982\uff1a\u300csPookyFISH\u300d)<\/li>\n\n\n\n<li class=\"\">\u540c\u6642<strong>\u6709\u5b57\u6bcd\u53ca\u81f3\u5c11\u4e00\u500b\u6578\u5b57\u6216\u7b26\u865f<\/strong> (\u5982\uff1a\u300csPookyFiSH3\u300d\u6216\u300c$PookyFI3H\u300d)<\/li>\n<\/ul>\n\n\n\n<p class=\"\">\u4e00\u500b\u300c\u597d\u300d(GOOD) \u5bc6\u78bc\u64c1\u6709\u5169\u500b\u4e0a\u8ff0\u7684\u7279\u6027\uff0c\u4e00\u500b\u300c\u5c1a\u53ef\u300d(ACCEPTABLE) \u5bc6\u78bc\u53ea\u64c1\u6709\u4e00\u500b\u7279\u6027\u3002\u4e0d\u7b26\u5408\u4e0a\u8ff0\u4efb\u4f55\u7279\u6027\u7684\u5247\u70ba\u300c\u5f31\u300d(WEAK) \u5bc6\u78bc\u3002\u8acb\u5beb\u4e00\u500b\u7a0b\u5f0f\u4f86\u5206\u6790\u6240\u7d66\u7684\u5bc6\u78bc\u7684\u5f37\u5ea6\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7bc4\u4f8b\u6e2c\u8cc7<\/h2>\n\n\n\n<figure class=\"wp-block-table nfd-wb-animate nfd-wb-fade-in-bottom-short\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7bc4\u4f8b\u8f38\u5165<\/th><th>\u7bc4\u4f8b\u8f38\u51fa<\/th><\/tr><\/thead><tbody><tr><td><strong>EOF<\/strong> \u8f38\u5165\uff0c\u6bcf\u7b46\u6e2c\u8cc7\u4e00\u884c\uff0c\u5176\u4e2d\u542b\u6709\u4e00\u500b\u5bc6\u78bc\uff0c\u9577\u5ea6\u6700\u5927\u70ba 30 \u5b57\u5143\u3002\u5bc6\u78bc\u4e2d\u6c92\u6709\u7a7a\u767d\u3002<\/td><td>\u4f9d\u64da\u4e0a\u8ff0\u7684\u7279\u6027\uff0c\u8f38\u51fa\u6240\u8f38\u5165\u5bc6\u78bc\u7684\u5f37\u5ea6\u3002<\/td><\/tr><tr><td>lizard<br>aardvark<br>Aardvark<br>Aardvark77<\/td><td>This password is WEAK<br>This password is ACCEPTABLE<br>This password is GOOD<br>This password is STRONG<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u984c\u601d\u8def<\/h2>\n\n\n\n<p class=\"\">\u53ef\u4ee5\u5ba3\u544a\u4e00\u500b ans \u8b8a\u6578\u8a08\u7b97\u5bc6\u78bc\u6709\u9054\u5230\u5e7e\u7a2e\u8981\u6c42\u3002<\/p>\n\n\n\n<p class=\"\">\u5982\u679c\u5b57\u4e32\u9577\u5ea6 &gt;= 8 \u5c31 ans++\u3002<\/p>\n\n\n\n<p class=\"\">\u5ba3\u544a\u56db\u500b\u5e03\u6797\u503c\uff0cup\u3001down\u3001alpha\u3001other\uff0c\u5168\u90e8\u9810\u8a2d\u70ba false\uff0c\u5206\u5225\u4ee3\u8868\u662f\u5426\u6709\u5927\u5beb\u5b57\u6bcd\u3001\u5c0f\u5beb\u5b57\u6bcd\u3001\u82f1\u6587\u5b57\u6bcd\u3001\u53ca\u5176\u4ed6\u5b57\u5143\u3002\u5c07\u5bc6\u78bc\u7684\u6bcf\u500b\u5b57\u5143\u9032\u884c\u5224\u65b7\uff0c\u53ef\u4ee5\u4f7f\u7528 isalpha\u3001isupper\u3001islower \u4f86\u505a\u5224\u65b7\uff0c\u8981\u5148\u5224\u65b7\u5b57\u5143\u662f\u5426\u70ba\u82f1\u6587\u5b57\u6bcd\u624d\u53ef\u4ee5\u5224\u65b7\u5927\u5c0f\u5beb\u3002\u5982\u679c\u4e0d\u662f\u82f1\u6587\u5b57\u6bcd\u7684\u8a71\u5c31\u5c07 other \u8a2d\u70ba true\u3002<\/p>\n\n\n\n<p class=\"\">\u5982\u679c up \u548c down \u7686\u70ba true\uff0c\u5c31 ans++\u3002<\/p>\n\n\n\n<p class=\"\">\u5982\u679c alpha \u548c other \u7686\u70ba true\uff0c\u4e5f\u662f ans++\u3002<\/p>\n\n\n\n<p class=\"\">\u6700\u5f8c\u4f9d\u7167\u9054\u5230\u591a\u5c11\u8981\u6c42\u8f38\u51fa\u6307\u5b9a\u7684\u7b54\u6848\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=a624\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge A624: Password Analyzer<\/a><\/h3>\n\n\n\n<div class=\"hcb_wrap nfd-wb-animate nfd-wb-reveal-right nfd-delay-50\"><pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\"><code>#include &lt;iostream&gt;\n#include &lt;map&gt;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    map&lt;int, string&gt;MAP;\n    MAP[0] = &quot;WEAK&quot;;\n    MAP[1] = &quot;ACCEPTABLE&quot;;\n    MAP[2] = &quot;GOOD&quot;;\n    MAP[3] = &quot;STRONG&quot;;\n    string str;\n    while (cin &gt;&gt; str)\n    {\n        int ans = 0, len = int(str.length());\n        if (len &gt;= 8) ans++;\n        bool up = false, down = false, alpha = false, other = false;\n        for (int i = 0; i&lt;len; i++)\n        {\n            if (isalpha(str[i]))\n            {\n                alpha = true;\n                if (isupper(str[i])) up = true;\n                if (islower(str[i])) down = true;\n            }\n            else other = true;\n        }\n        if (up && down) ans++;\n        if (alpha && other) ans++;\n        cout &lt;&lt; &quot;This password is &quot; &lt;&lt; MAP[ans] &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge A624\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4f60\u5728\u4e00\u5bb6\u6210\u9577\u4e2d\u7684\u96fb\u5b50\u5546\u52d9\u7db2\u7ad9\u5de5\u4f5c\uff0c\u800c\u5b83\u4e5f\u6210\u4e86\u7aca\u8cca\u89ac\u89a6\u7684\u5c0d\u8c61\u3002\u7aca\u8cca\u4ee5\u731c\u6e2c\u5bc6\u78bc\u7684\u65b9\u5f0f\u4f86\u5b58\u53d6\u9867\u5ba2\u7684\u5e33\u865f\uff0c\u9019\u5e38\u5e38\u662f\u8f15\u800c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[29],"tags":[14,8,11,34,9],"class_list":["post-526","post","type-post","status-publish","format-standard","hentry","category-zerojudge-","tag-map","tag-8","tag-11","tag-34","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/comments?post=526"}],"version-history":[{"count":3,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/526\/revisions"}],"predecessor-version":[{"id":716,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/526\/revisions\/716"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}