{"id":1430,"date":"2023-05-18T10:28:14","date_gmt":"2023-05-18T02:28:14","guid":{"rendered":"https:\/\/sanlangcode.com\/?p=1430"},"modified":"2023-05-18T10:28:14","modified_gmt":"2023-05-18T02:28:14","slug":"%e5%8d%8e%e4%b8%baod%e6%9c%ba%e8%af%952023%e3%80%90%e5%85%a8%e6%98%af%e9%a2%98%e5%ba%93%e5%8e%9f%e9%a2%98%e3%80%91","status":"publish","type":"post","link":"https:\/\/sanlangcode.com\/index.php\/2023\/05\/18\/%e5%8d%8e%e4%b8%baod%e6%9c%ba%e8%af%952023%e3%80%90%e5%85%a8%e6%98%af%e9%a2%98%e5%ba%93%e5%8e%9f%e9%a2%98%e3%80%91\/","title":{"rendered":"\u534e\u4e3aOD\u673a\u8bd52023\u3010\u5168\u662f\u9898\u5e93\u539f\u9898\u3011"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/sanlangcode.com\/wp-content\/uploads\/2023\/05\/image-1.png\" alt=\"\" class=\"wp-image-1433\"\/><\/figure>\n\n\n\n<p>1.\u5355\u5165\u53e3\u7a7a\u95f2\u533a\u57df<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\nAuthor:Sanro\nTime:2023.05.17 18:27:49\nBlog:https:\/\/sanlangcode.com\nEmail:sanlangcode@163.com\nDesc:\n*\/\n\nimport java.util.*;\nimport java.io.*;\n\nimport java.util.Scanner;\n\npublic class HJ202301 {\n    private static int startI;\n    private static int startJ;\n\n    public static int dfs(char&#91;]&#91;] map, boolean&#91;]&#91;] visited, int i, int j) {\n        if (i &lt; 0 || j &lt; 0 || i >= map.length || j >= map&#91;0].length || map&#91;i]&#91;j] == 'X' || visited&#91;i]&#91;j]) {\n            return 0;\n        }\n        if ((i == 0 || j == 0 || i == map.length - 1 || j == map&#91;0].length - 1) &amp;&amp; map&#91;i]&#91;j] == 'O' &amp;&amp; !visited&#91;i]&#91;j] &amp;&amp; (i != startI || j != startJ)) {\n            return -10000;\n        }\n        visited&#91;i]&#91;j] = true;\n        return 1 + dfs(map, visited, i - 1, j) + dfs(map, visited, i + 1, j) + dfs(map, visited, i, j - 1) + dfs(map, visited, i, j + 1);\n    }\n\n    public static void main(String&#91;] args) {\n\n        Scanner in = new Scanner(System.in);\n        int m = in.nextInt();\n        int n = in.nextInt();\n        char&#91;]&#91;] inputArr = new char&#91;m]&#91;n];\n        in.nextLine();\n        for (int i = 0; i &lt; m; ++i) {\n            for (int j = 0; j &lt; n; ++j) {\n                inputArr&#91;i]&#91;j] = in.next().charAt(0);\n            }\n        }\n        int x = 0, y = 0;\n        int max = Integer.MIN_VALUE;\n        boolean flag = false;\n        for (int i = 0; i &lt; m; ++i) {\n            if (inputArr&#91;i]&#91;0] == 'O') {\n                boolean&#91;]&#91;] visited = new boolean&#91;m]&#91;n];\n                startI = i;\n                startJ = 0;\n                int area = dfs(inputArr, visited, i, 0);\n                if (area > 0 &amp;&amp; area > max) {\n                    flag = false;\n                    max = area;\n                    x = i;\n                    y = 0;\n                } else if (area > 0 &amp;&amp; area == max) {\n                    flag = true;\n                }\n            }\n            if (inputArr&#91;i]&#91;n - 1] == 'O') {\n                boolean&#91;]&#91;] visited = new boolean&#91;m]&#91;n];\n                startI = i;\n                startJ = n - 1;\n                int area = dfs(inputArr, visited, i, n - 1);\n                if (area > 0 &amp;&amp; area > max) {\n                    flag = false;\n                    max = area;\n                    x = i;\n                    y = n - 1;\n                } else if (area > 0 &amp;&amp; area == max) {\n                    flag = true;\n                }\n            }\n        }\n\n        for (int j = 1; j &lt; n - 1; ++j) {\n            if (inputArr&#91;0]&#91;j] == 'O') {\n                boolean&#91;]&#91;] visited = new boolean&#91;m]&#91;n];\n                startI = 0;\n                startJ = j;\n                int area = dfs(inputArr, visited, 0, j);\n                if (area > 0 &amp;&amp; area > max) {\n                    flag = false;\n                    max = area;\n                    x = 0;\n                    y = j;\n                } else if (area > 0 &amp;&amp; area == max) {\n                    flag = true;\n                }\n            }\n            if (inputArr&#91;m - 1]&#91;j] == 'O') {\n                boolean&#91;]&#91;] visited = new boolean&#91;m]&#91;n];\n                startI = m - 1;\n                startJ = j;\n                int area = dfs(inputArr, visited, m - 1, j);\n                if (area > 0 &amp;&amp; area > max) {\n                    flag = false;\n                    max = area;\n                    x = m - 1;\n                    y = j;\n                } else if (area > 0 &amp;&amp; area == max) {\n                    flag = true;\n                }\n            }\n        }\n        if (max &lt;= 0) {\n            System.out.print(\"NULL\");\n        } else if (!flag) {\n            System.out.print(x + \" \" + y + \" \" + max);\n        } else {\n            System.out.print(max);\n        }\n    }\n\n}\n<\/code><\/pre>\n\n\n\n<p>2.\u6c47\u7387\u8f6c\u6362<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\nAuthor:Sanro\nTime:2023.05.17 18:31:20\nBlog:https:\/\/sanlangcode.com\nEmail:sanlangcode@163.com\nDesc:\n*\/\n\nimport java.util.*;\nimport java.io.*;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\npublic class HJ202302 {\n    public static void main(String&#91;] args) {\n        try(Scanner sc = new Scanner(System.in)){\n        int n= sc.nextInt();\n        sc.nextLine();\n        String&#91;] Str = new String&#91;n];\n        for (int i = 0; i &lt; n; i++) {\n            Str&#91;i]=sc.nextLine();\n        }\n        int res = Exchange(Str);\n        System.out.println(res);\n    }}\n\n    private static final Pattern pN = Pattern.compile(\"&#91;0-9]+\");\n    private static final Pattern pM = Pattern.compile(\"(&#91;a-z]|&#91;A-Z])+\");\n\n    public static int Exchange(String&#91;] Str){\n        Map&lt;String,Double> ex= new HashMap&lt;>();\n        ex.put(\"CNY\",0.01);\n        ex.put(\"fen\",1.);\n        ex.put(\"JPY\",.1825);\n        ex.put(\"sen\",18.25);\n        ex.put(\"HKD\",0.0123);\n        ex.put(\"cents\",1.23);\n        ex.put(\"EUR\",0.0014);\n        ex.put(\"eurocents\",0.14);\n        ex.put(\"GBP\",0.0012);\n        ex.put(\"pence\",0.12);\n\n        double res =0. ;\n        for (String s : Str){\n            String str = s;\n            String num=\"\";\n            String word = \"\";\n            while (str.length() > 0){\n                Matcher maN = pN.matcher(str);\n                if (maN.find()){\n                    num =maN.group();\n                    str = str.substring(num.length());\n                }\n                Matcher maM = pM.matcher(str);\n                if (maM.find()){\n                    word =maM.group();\n                    str = str.substring(word.length());\n                }\n                res+=Double.parseDouble(num)\/ex.get(word);\n            }\n        }\n        return (int)res;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>3.\u673a\u5668\u4eba\u6d3b\u52a8\u533a\u57df<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\nAuthor:Sanro\nTime:2023.05.17 18:31:32\nBlog:https:\/\/sanlangcode.com\nEmail:sanlangcode@163.com\nDesc:\n*\/\n\nimport java.util.*;\nimport java.io.*;\npublic class HJ202303 {\n\n    public static int RobotDFS(int&#91;]&#91;] nums, int i, int j, int preNum) {\n        if (i &lt; 0 || i >= nums.length || j &lt; 0 || j >= nums&#91;0].length) {return 0; }\n\n        int curNum = nums&#91;i]&#91;j];\n        if (curNum == -1) { return 0;}\n        if (Math.abs(curNum - preNum) > 1) {return 0;}\n\n        nums&#91;i]&#91;j] = -1;\n        int count = 1;\n        count += RobotDFS(nums, i - 1, j, curNum);\n        count += RobotDFS(nums, i + 1, j, curNum);\n        count += RobotDFS(nums, i, j - 1, curNum);\n        count += RobotDFS(nums, i, j + 1, curNum);\n        return count;\n    }\n\n    public static void main(String&#91;] args) {\n        Scanner sc = new Scanner(System.in);\n        String numStr = sc.nextLine();\n        String&#91;] strings = numStr.split(\" \");\n        int m = Integer.parseInt(strings&#91;0]);\n        int n = Integer.parseInt(strings&#91;1]);\n\n        int&#91;]&#91;] nums = new int&#91;m]&#91;n];\n        for (int i = 0; i &lt; m; i++) {\n            String line = sc.nextLine();\n            String&#91;] split = line.split(\" \");\n            for (int j = 0; j &lt; split.length; j++) {\n                nums&#91;i]&#91;j] = Integer.parseInt(split&#91;j]);\n            }\n        }\n\n        int Resultmax = 0;\n        for (int i = 0; i &lt; m; i++) {\n            for (int j = 0; j &lt; n; j++) {\n                int currNum = nums&#91;i]&#91;j];\n                if (currNum != -1) {\n                    Resultmax = Math.max(Resultmax, RobotDFS(nums, i, j, currNum));\n                }\n            }\n        }\n        System.out.println(Resultmax);\n    }\n}\n<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u5355\u5165\u53e3\u7a7a\u95f2\u533a\u57df 2.\u6c47\u7387\u8f6c\u6362&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1430","post","type-post","status-publish","format-standard","hentry","category-4"],"_links":{"self":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/1430","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=1430"}],"version-history":[{"count":0,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/1430\/revisions"}],"wp:attachment":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/media?parent=1430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/categories?post=1430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/tags?post=1430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}