{"id":602,"date":"2024-06-23T09:00:00","date_gmt":"2024-06-23T01:00:00","guid":{"rendered":"https:\/\/seanxd.com\/?p=602"},"modified":"2024-06-25T16:54:42","modified_gmt":"2024-06-25T08:54:42","slug":"zerojudge-k926","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-k926\/","title":{"rendered":"ZeroJudge K926: Correction"},"content":{"rendered":"\n\n\n<p>\u5c0f\u660e\u6700\u8fd1\u5728\u7df4\u7fd2\u82f1\u6587\u6253\u5b57\uff0c\u6bcf\u6b21\u7df4\u7fd2\u5f8c\uff0c\u7cfb\u7d71\u6703\u5e6b\u5c0f\u660e\u8a08\u7b97\u5dee\u7570\u91cf\u3002\u5dee\u7570\u91cf\u8a08\u7b97\u65b9\u5f0f\u70ba\u5c0f\u660e\u6240\u6253\u6587\u5b57\u8207\u6b63\u78ba\u6587\u5b57\u76f8\u5c0d\u4f4d\u7f6e\u4e0d\u540c\u82f1\u6587\u5b57\u6bcd\u7684\u6578\u76ee\uff0c\u4f8b\u5982 mouse \u548c house \u4e4b\u9593\u7684\u5dee\u7570\u91cf\u70ba 1\u3002<br>\u4ed6\u7d93\u5e38\u5fd8\u8a18\u82f1\u6587\u5b57\u6bcd\u5728\u9375\u76e4\u7684\u4f4d\u7f6e\uff0c\u6240\u4ee5\u5e38\u5e38\u6253\u932f\u5b57\u3002<\/p>\n\n\n\n<p>\u7cfb\u7d71\u63d0\u4f9b\u4e00\u7a2e\u300c\u4e00\u5c0d\u4e00\u300d\u7684\u6821\u6b63\u529f\u80fd\uff0c\u6bcf\u6b21\u6821\u6b63\u6703\u5c07\u5b57\u4e32\u4e2d<strong>\u6240\u6709\u4e00\u6a23\u7684\u6307\u5b9a\u5b57\u6bcd\u90fd\u66ff\u63db\u6210\u53e6\u4e00\u500b\u6307\u5b9a\u5b57\u6bcd<\/strong>\u3002\u4e00\u7d93\u6821\u6b63\uff0c\u6587\u5b57\u5c31\u7121\u6cd5\u518d\u6062\u5fa9\uff0c\u4e5f\u5c31\u662f\u7b2c\u4e8c\u6b21\u6821\u6b63\u6703\u4ee5\u7b2c\u4e00\u6b21\u6821\u6b63\u5f8c\u7684\u7d50\u679c\u70ba\u57fa\u790e\u4f86\u9032\u884c\u3002<\/p>\n\n\n\n<p>\u8209\u4f8b\u4f86\u8aaa\uff0c\u6b63\u78ba\u7684\u55ae\u5b57\u70ba ccdd\uff0c\u5c0f\u660e\u6240\u6253\u7684\u6587\u5b57\u70ba aabb\u3002\u82e5\u7cfb\u7d71\u57f7\u884c\u300ca \u66ff\u63db\u6210 c\u300d\u7684<br>\u6821\u6b63\uff0c\u5247 aabb \u6703\u6821\u6b63\u70ba ccbb\u3002\u82e5\u7cfb\u7d71\u7dca\u63a5\u8457\u57f7\u884c\u300ca \u66ff\u63db\u6210 g\u300d\u7684\u6821\u6b63\uff0c\u5247\u4e0d\u6703\u6709\u8b8a\u5316\uff0c\u56e0<br>\u70ba\u7576\u524d\u6587\u5b57\u5df2\u7d93\u8b8a\u6210 ccbb \u4e86\uff0c\u5176\u4e2d\u5df2\u4e0d\u542b a\u3002<\/p>\n\n\n\n<p>\u8acb\u4f60\u5beb\u4e00\u500b\u7a0b\u5f0f\u8a08\u7b97\u5c0f\u660e\u6240\u6253\u7684\u6587\u5b57<strong>\u7d93\u6821\u6b63\u5f8c\u7684\u5dee\u7570\u91cf<\/strong>\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>\u8f38\u5165\u7b2c\u4e00\u5217\u548c\u7b2c\u4e8c\u5217\u5404\u6709\u4e00\u500b\u82f1\u6587\u5b57\u4e32 S1 \u548c S2 (\u50c5\u5305\u542b\u5c0f\u5beb\u82f1\u6587\u5b57\u6bcd\uff0c\u9577\u5ea6\u4e0d\u8d85\u904e 100\uff0c\u4e14 S1 \u548c S2 \u7684\u9577\u5ea6\u4fdd\u8b49\u76f8\u7b49\uff09\uff0c\u5206\u5225\u4ee3\u8868\u5c0f\u660e\u6240\u6253\u4e4b\u6587\u5b57\u4ee5\u53ca\u6b63\u78ba\u6587\u5b57\uff0c\u7b2c\u4e09\u5217\u6709\u4e00\u500b\u6574\u6578 N (1 \u2264 N \u2264100) \u8868\u793a\u6821\u6b63\u6b21\u6578\uff0c\u63a5\u4e0b\u4f86\u6709 N \u5217\uff0c\u6bcf\u5217\u6709\u5169\u500b\u5b57\u5143 X<sub>i<\/sub> \u548c Y<sub>i<\/sub> (1 \u2264 i \u2264 N)\uff0c\u8868\u793a\u5c07\u7576\u524d\u6587\u5b57\u4e2d\u7684 Xi \u5b57\u5143\u66ff\u4ee3\u70ba Yi\u3002\u6240\u8b02\u7576\u524d\u6587\u5b57\u662f\u6307\u5f9e S1 \u7d93\u904e\u524d\u9762\u82e5\u5e72\u6b21\u6821\u6b63\u5f8c\u7684\u6587\u5b57\u3002<\/td><td>\u8f38\u51fa\u6821\u6b63\u5f8c\u5169\u500b\u5b57\u4e32\u7684\u8ddd\u96e2 (<strong>\u7d93\u6821\u6b63\u5f8c\u7684\u5dee\u7570\u91cf<\/strong>)\u3002<\/td><\/tr><tr><td>aabb<br>ccdd<br>1<br>a c<\/td><td>2<\/td><\/tr><tr><td>aabb<br>ccdd<br>2<br>a b<br>b c<\/td><td>2<\/td><\/tr><tr><td>time<br>game<br>2<br>i a<br>t g<\/td><td>0<\/td><\/tr><tr><td>elephant<br>kangaroo<br>3<br>e o<br>p k<br>a n<\/td><td>8<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u984c\u601d\u8def<\/h2>\n\n\n\n<p>\u4f7f\u7528 For\u8ff4\u5708 \u5224\u65b7\u76ee\u524d\u5b57\u5143\u662f\u4ec0\u9ebc\uff0c\u5982\u679c\u662f X<sub>i<\/sub> \u5c31\u5c07\u76ee\u524d\u5b57\u5143\u63db\u6210 Y<sub>i<\/sub>\u3002<\/p>\n\n\n\n<p>\u5c07\u5b57\u5143\u66ff\u63db\u5b8c\u4e4b\u5f8c\uff0c\u5728\u540c\u4e00\u500b\u4f4d\u7f6e\u6bd4\u5c0d\u4e0d\u540c\u7684\u5b57\u4e32\u4e4b\u5b57\u5143\u662f\u5426\u4e00\u81f4\uff0c\u5982\u679c\u4e0d\u4e00\u81f4\u7b54\u6848\u5c31 +1\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=k926\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge K926: \u932f\u5b57\u6821\u6b63 (Correction)<\/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;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    string input, correct;\n    int N;\n    cin &gt;&gt; input &gt;&gt; correct &gt;&gt; N;\n    for (int i = 0; i&lt;N; i++) {\n        char a, b;\n        cin &gt;&gt; a &gt;&gt; b;\n        for (int j = 0; j&lt;input.length(); j++) {\n            if (input[j] == a) input[j] = b;\n        }\n    }\n    int ans = 0;\n    for (int i = 0; i&lt;input.length(); i++) {\n        if (input[i] != correct[i]) ans++;\n    }\n    cout &lt;&lt; ans &lt;&lt; &quot;\\n&quot;;\n}\n\n\/\/ZeroJudge K926\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u660e\u6700\u8fd1\u5728\u7df4\u7fd2\u82f1\u6587\u6253\u5b57\uff0c\u6bcf\u6b21\u7df4\u7fd2\u5f8c\uff0c\u7cfb\u7d71\u6703\u5e6b\u5c0f\u660e\u8a08\u7b97\u5dee\u7570\u91cf\u3002\u5dee\u7570\u91cf\u8a08\u7b97\u65b9\u5f0f\u70ba\u5c0f\u660e\u6240\u6253\u6587\u5b57\u8207\u6b63\u78ba\u6587\u5b57\u76f8\u5c0d\u4f4d\u7f6e\u4e0d\u540c [&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":[25],"tags":[8,11,9],"class_list":["post-602","post","type-post","status-publish","format-standard","hentry","category-ioi-apcs","tag-8","tag-11","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/602","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=602"}],"version-history":[{"count":2,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/602\/revisions"}],"predecessor-version":[{"id":989,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/602\/revisions\/989"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}