{"id":39329,"date":"2025-05-23T09:49:25","date_gmt":"2025-05-23T01:49:25","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/39329.html"},"modified":"2025-05-23T09:49:25","modified_gmt":"2025-05-23T01:49:25","slug":"%e7%89%9b%e5%ae%a2%e5%91%a8%e8%b5%9b-round-92-%e9%a2%98%e8%a7%a3-java","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/39329.html","title":{"rendered":"\u725b\u5ba2\u5468\u8d5b Round 92 \u9898\u89e3 Java"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"XqmkG-toc\" style=\"margin-left:0px\">A \u5c0f\u7ea2\u7684\u7b7e\u5230\u9898<\/p>\n<p id=\"xJ5LG-toc\" style=\"margin-left:0px\">B \u5c0f\u7ea2\u7684\u6a21\u62df\u9898<\/p>\n<p id=\"ypZeZ-toc\" style=\"margin-left:0px\">C \u5c0f\u7ea2\u7684\u65b9\u795e\u9898<\/p>\n<p id=\"ymmI0-toc\" style=\"margin-left:0px\">D \u5c0f\u7ea2\u7684\u6570\u5b66\u9898<\/p>\n<p id=\"FQGx2-toc\" style=\"margin-left:0px\">E \u5c0f\u7ea2\u7684 ds \u9898<\/p>\n<p id=\"ITXXu-toc\" style=\"margin-left:0px\">F \u5c0f\u7ea2\u7684\u5c0f\u82ef\u9898<\/p>\n<hr id=\"hr-toc\" \/>\n<h2 id=\"XqmkG\">A \u5c0f\u7ea2\u7684\u7b7e\u5230\u9898<\/h2>\n<p id=\"ue4eec9ba\">\u76f4\u63a5\u6784\u9020\u7c7b\u4f3c\u4e8e a_aaaa&#xff0c;a_aaaaaaaa \u8fd9\u79cd \u5373\u53ef<\/p>\n<p>\/\/ &#064;github https:\/\/github.com\/Dddddduo<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/acm-java-algorithm<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/Dduo-mini-data_structure<br \/>\nimport java.util.*;<br \/>\nimport java.io.*;<br \/>\nimport java.math.*;<br \/>\nimport java.lang.*;<br \/>\nimport java.time.*;<\/p>\n<p>\/**<br \/>\n * \u9898\u76ee\u5730\u5740<br \/>\n *<br \/>\n *\/<\/p>\n<p>\/\/ xixi\u2661\u897f<br \/>\npublic class Main {<\/p>\n<p>    static IoScanner sc &#061; new IoScanner();<br \/>\n    static final int mod &#061; (int) (1e9 &#043; 7);<br \/>\n\/\/    static final int mod &#061; (int) (1e9 &#043; 7);<\/p>\n<p>    static int n;<br \/>\n    static int arr[];<br \/>\n    static boolean visited[];<br \/>\n    static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; adj &#061; new ArrayList&lt;&gt;();<\/p>\n<p>    \/**<br \/>\n     * &#064;throws IOException<br \/>\n     *\/<br \/>\n    private static void solve() throws IOException {<br \/>\n        \/\/ todo<br \/>\n        int n&#061;sc.nextInt();<br \/>\n        dduo(&#034;a_&#034;);<br \/>\n        for(int i&#061;0;i&lt;n-2;i&#043;&#043;) {<br \/>\n        dduo(&#034;a&#034;);<br \/>\n        }<br \/>\n    }<\/p>\n<p>    public static void main(String[] args) throws Exception {<br \/>\n        int t &#061; 1;<br \/>\n\/\/        t &#061; sc.nextInt();<br \/>\n        while (t&#8211; &gt; 0) {<br \/>\n            solve();<br \/>\n        }<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduo(T t) {<br \/>\n        System.out.print(t);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln() {<br \/>\n        System.out.println(&#034;&#034;);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln(T t) {<br \/>\n        System.out.println(t);<br \/>\n    }<br \/>\n}<\/p>\n<p>\/**<br \/>\n * IoScanner\u7c7b<br \/>\n *<br \/>\n * &#064;author Dduo<br \/>\n * &#064;version 1.0<br \/>\n * &#064;description \u901a\u8fc7IO\u6d41\u64cd\u4f5c\u7f13\u51b2\u533a\u51cf\u5c11\u4e86\u4e0e\u5e95\u5c42\u8f93\u5165\u8f93\u51fa\u8bbe\u5907\u7684\u4ea4\u4e92\u6b21\u6570&#xff0c;\u65e8\u5728\u7b80\u5316 Java \u4e2d\u7684\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u64cd\u4f5c\u3002<br \/>\n *\/<br \/>\nclass IoScanner {<br \/>\n    BufferedReader bf;<br \/>\n    StringTokenizer st;<br \/>\n    BufferedWriter bw;<\/p>\n<p>    public IoScanner() {<br \/>\n        bf &#061; new BufferedReader(new InputStreamReader(System.in));<br \/>\n        st &#061; new StringTokenizer(&#034;&#034;);<br \/>\n        bw &#061; new BufferedWriter(new OutputStreamWriter(System.out));<br \/>\n    }<\/p>\n<p>    public String nextLine() throws IOException {<br \/>\n        return bf.readLine();<br \/>\n    }<\/p>\n<p>    public String next() throws IOException {<br \/>\n        while (!st.hasMoreTokens()) {<br \/>\n            st &#061; new StringTokenizer(bf.readLine());<br \/>\n        }<br \/>\n        return st.nextToken();<br \/>\n    }<\/p>\n<p>    public char nextChar() throws IOException {<br \/>\n        return next().charAt(0);<br \/>\n    }<\/p>\n<p>    public int nextInt() throws IOException {<br \/>\n        return Integer.parseInt(next());<br \/>\n    }<\/p>\n<p>    public long nextLong() throws IOException {<br \/>\n        return Long.parseLong(next());<br \/>\n    }<\/p>\n<p>    public double nextDouble() throws IOException {<br \/>\n        return Double.parseDouble(next());<br \/>\n    }<\/p>\n<p>    public float nextFloat() throws IOException {<br \/>\n        return Float.parseFloat(next());<br \/>\n    }<\/p>\n<p>    public BigInteger nextBigInteger() throws IOException {<br \/>\n        return new BigInteger(next());<br \/>\n    }<\/p>\n<p>    public BigDecimal nextDecimal() throws IOException {<br \/>\n        return new BigDecimal(next());<br \/>\n    }<br \/>\n} <\/p>\n<h2 id=\"xJ5LG\">B \u5c0f\u7ea2\u7684\u6a21\u62df\u9898<\/h2>\n<p id=\"ub62c31ee\">\u7b2c\u4e00\u773c\u4ee5\u4e3a\u662f dfs<\/p>\n<p id=\"u5ce652e6\">\u4f46\u662f\u770b\u5230\u4e86<\/p>\n<p id=\"u226d63e0\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"32\" id=\"uf456a85b\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014918-682fd41e48f2f.png\" width=\"539\" \/><\/p>\n<p id=\"ud5263fde\">\u53ea\u6709\u4e00\u4e2a\u9677\u9631\u683c\u5b50<\/p>\n<p id=\"u6e056b80\">\u6240\u4ee5\u53ea\u8981\u89c4\u5b9a\u4e00\u6761\u5230\u7ec8\u70b9\u7684\u8def\u7ebf \u5148\u4e00\u76f4\u5f80\u53f3\u8d70 \u518d\u4e00\u76f4\u5f80\u4e0b\u8d70<\/p>\n<p id=\"uc89c717e\">\u5982\u679c\u9677\u9631\u683c\u5b50\u5728\u8fd9\u6761\u7ebf\u8def\u4e0a<\/p>\n<p id=\"u526f0de8\">\u5c31\u4e00\u76f4\u5f80\u4e0b\u8d70 \u518d\u4e00\u76f4\u5f80\u53f3\u8d70 \u4ee5\u5230\u8fbe\u7ec8\u70b9<\/p>\n<p>\/\/ &#064;github https:\/\/github.com\/Dddddduo<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/acm-java-algorithm<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/Dduo-mini-data_structure<br \/>\nimport java.util.*;<br \/>\nimport java.io.*;<br \/>\nimport java.math.*;<br \/>\nimport java.lang.*;<br \/>\nimport java.time.*;<\/p>\n<p>\/**<br \/>\n * \u9898\u76ee\u5730\u5740<br \/>\n *<br \/>\n *\/<\/p>\n<p>\/\/ xixi\u2661\u897f<br \/>\npublic class Main {<\/p>\n<p>    static IoScanner sc &#061; new IoScanner();<br \/>\n    static final int mod &#061; (int) (1e9 &#043; 7);<br \/>\n\/\/    static final int mod &#061; (int) (1e9 &#043; 7);<\/p>\n<p>    static int n;<br \/>\n    static int arr[];<br \/>\n    static boolean visited[];<br \/>\n    static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; adj &#061; new ArrayList&lt;&gt;();<\/p>\n<p>    \/**<br \/>\n     * &#064;throws IOException<br \/>\n     *\/<br \/>\n    private static void solve() throws IOException {<br \/>\n        \/\/ todo<br \/>\n        int n&#061;sc.nextInt();<br \/>\n        int m&#061;sc.nextInt();<\/p>\n<p>        char arr[][]&#061;new char[n][m];<br \/>\n        for(int i&#061;0;i&lt;n;i&#043;&#043;) {<br \/>\n        String str&#061;sc.next();<br \/>\n        arr[i]&#061;str.toCharArray();<br \/>\n        }<\/p>\n<p>        int x&#061;0;<br \/>\n        int y&#061;0;<br \/>\n        for(int i&#061;0;i&lt;n;i&#043;&#043;) {<br \/>\n        for(int j&#061;0;j&lt;m;j&#043;&#043;) {<br \/>\n        if(arr[i][j]&#061;&#061;&#039;#&#039;) {<br \/>\n        x&#061;i;<br \/>\n        y&#061;j;<br \/>\n        }<br \/>\n        }<br \/>\n        }<\/p>\n<p>        if(x&#061;&#061;0||y&#061;&#061;m-1) {<br \/>\n          for(int i&#061;0;i&lt;n-1;i&#043;&#043;) {<br \/>\n        dduo(&#034;S&#034;);<br \/>\n        }<br \/>\n        for(int i&#061;0;i&lt;m-1;i&#043;&#043;) {<br \/>\n        dduo(&#034;D&#034;);<br \/>\n        }<br \/>\n        }else if(y&#061;&#061;0||x&#061;&#061;n-1){<br \/>\n        for(int i&#061;0;i&lt;m-1;i&#043;&#043;) {<br \/>\n        dduo(&#034;D&#034;);<br \/>\n        }<br \/>\n        for(int i&#061;0;i&lt;n-1;i&#043;&#043;) {<br \/>\n        dduo(&#034;S&#034;);<br \/>\n        }<br \/>\n        }else {<br \/>\n        for(int i&#061;0;i&lt;n-1;i&#043;&#043;) {<br \/>\n        dduo(&#034;S&#034;);<br \/>\n        }<br \/>\n        for(int i&#061;0;i&lt;m-1;i&#043;&#043;) {<br \/>\n        dduo(&#034;D&#034;);<br \/>\n        }<br \/>\n        }<\/p>\n<p>    }<\/p>\n<p>    public static void main(String[] args) throws Exception {<br \/>\n        int t &#061; 1;<br \/>\n\/\/        t &#061; sc.nextInt();<br \/>\n        while (t&#8211; &gt; 0) {<br \/>\n            solve();<br \/>\n        }<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduo(T t) {<br \/>\n        System.out.print(t);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln() {<br \/>\n        System.out.println(&#034;&#034;);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln(T t) {<br \/>\n        System.out.println(t);<br \/>\n    }<br \/>\n}<\/p>\n<p>\/**<br \/>\n * IoScanner\u7c7b<br \/>\n *<br \/>\n * &#064;author Dduo<br \/>\n * &#064;version 1.0<br \/>\n * &#064;description \u901a\u8fc7IO\u6d41\u64cd\u4f5c\u7f13\u51b2\u533a\u51cf\u5c11\u4e86\u4e0e\u5e95\u5c42\u8f93\u5165\u8f93\u51fa\u8bbe\u5907\u7684\u4ea4\u4e92\u6b21\u6570&#xff0c;\u65e8\u5728\u7b80\u5316 Java \u4e2d\u7684\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u64cd\u4f5c\u3002<br \/>\n *\/<br \/>\nclass IoScanner {<br \/>\n    BufferedReader bf;<br \/>\n    StringTokenizer st;<br \/>\n    BufferedWriter bw;<\/p>\n<p>    public IoScanner() {<br \/>\n        bf &#061; new BufferedReader(new InputStreamReader(System.in));<br \/>\n        st &#061; new StringTokenizer(&#034;&#034;);<br \/>\n        bw &#061; new BufferedWriter(new OutputStreamWriter(System.out));<br \/>\n    }<\/p>\n<p>    public String nextLine() throws IOException {<br \/>\n        return bf.readLine();<br \/>\n    }<\/p>\n<p>    public String next() throws IOException {<br \/>\n        while (!st.hasMoreTokens()) {<br \/>\n            st &#061; new StringTokenizer(bf.readLine());<br \/>\n        }<br \/>\n        return st.nextToken();<br \/>\n    }<\/p>\n<p>    public char nextChar() throws IOException {<br \/>\n        return next().charAt(0);<br \/>\n    }<\/p>\n<p>    public int nextInt() throws IOException {<br \/>\n        return Integer.parseInt(next());<br \/>\n    }<\/p>\n<p>    public long nextLong() throws IOException {<br \/>\n        return Long.parseLong(next());<br \/>\n    }<\/p>\n<p>    public double nextDouble() throws IOException {<br \/>\n        return Double.parseDouble(next());<br \/>\n    }<\/p>\n<p>    public float nextFloat() throws IOException {<br \/>\n        return Float.parseFloat(next());<br \/>\n    }<\/p>\n<p>    public BigInteger nextBigInteger() throws IOException {<br \/>\n        return new BigInteger(next());<br \/>\n    }<\/p>\n<p>    public BigDecimal nextDecimal() throws IOException {<br \/>\n        return new BigDecimal(next());<br \/>\n    }<br \/>\n} <\/p>\n<h2 id=\"ypZeZ\">C \u5c0f\u7ea2\u7684\u65b9\u795e\u9898<\/h2>\n<p id=\"u051c48ff\">\u5176\u5b9e\u6211\u60f3\u4e86\u4e00\u4f1a<\/p>\n<p id=\"ua4e972f4\">\u7136\u540e\u6839\u636e\u6837\u4f8b\u8bd5\u4e86\u8bd5<\/p>\n<p id=\"uc04f7d9f\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"317\" id=\"u3bf5c455\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014918-682fd41e55f7f.png\" width=\"871\" \/><\/p>\n<p id=\"ud02581fd\">\u8f93\u5165 4<\/p>\n<p id=\"u86e43123\">1 4 3 2<\/p>\n<p id=\"ufff791e5\">\u8f93\u5165 5<\/p>\n<p id=\"uf2ac840a\">1 5 4 3 2<\/p>\n<p id=\"uc0b5214e\">\u90fd\u662f\u7b26\u5408\u7684<\/p>\n<p>\/\/ &#064;github https:\/\/github.com\/Dddddduo<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/acm-java-algorithm<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/Dduo-mini-data_structure<br \/>\nimport java.util.*;<br \/>\nimport java.io.*;<br \/>\nimport java.math.*;<br \/>\nimport java.lang.*;<br \/>\nimport java.time.*;<\/p>\n<p>\/**<br \/>\n * \u9898\u76ee\u5730\u5740<br \/>\n *<br \/>\n *\/<\/p>\n<p>\/\/ xixi\u2661\u897f<br \/>\npublic class Main {<\/p>\n<p>    static IoScanner sc &#061; new IoScanner();<br \/>\n    static final int mod &#061; (int) (1e9 &#043; 7);<br \/>\n\/\/    static final int mod &#061; (int) (1e9 &#043; 7);<\/p>\n<p>    static int n;<br \/>\n    static int arr[];<br \/>\n    static boolean visited[];<br \/>\n    static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; adj &#061; new ArrayList&lt;&gt;();<\/p>\n<p>    \/**<br \/>\n     * &#064;throws IOException<br \/>\n     *\/<br \/>\n    private static void solve() throws IOException {<br \/>\n        \/\/ todo<br \/>\n        int n&#061;sc.nextInt();<\/p>\n<p>        if(n&#061;&#061;1||n&#061;&#061;2) {<br \/>\n        dduoln(&#034;-1&#034;);<br \/>\n        return;<br \/>\n        }<\/p>\n<p>        dduo(1&#043;&#034; &#034;);<\/p>\n<p>        for(int i&#061;n;i&gt;&#061;2;i&#8211;) {<br \/>\n        dduo(i&#043;&#034; &#034;);<br \/>\n        }<br \/>\n    }<\/p>\n<p>    public static void main(String[] args) throws Exception {<br \/>\n        int t &#061; 1;<br \/>\n\/\/        t &#061; sc.nextInt();<br \/>\n        while (t&#8211; &gt; 0) {<br \/>\n            solve();<br \/>\n        }<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduo(T t) {<br \/>\n        System.out.print(t);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln() {<br \/>\n        System.out.println(&#034;&#034;);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln(T t) {<br \/>\n        System.out.println(t);<br \/>\n    }<br \/>\n}<\/p>\n<p>\/**<br \/>\n * IoScanner\u7c7b<br \/>\n *<br \/>\n * &#064;author Dduo<br \/>\n * &#064;version 1.0<br \/>\n * &#064;description \u901a\u8fc7IO\u6d41\u64cd\u4f5c\u7f13\u51b2\u533a\u51cf\u5c11\u4e86\u4e0e\u5e95\u5c42\u8f93\u5165\u8f93\u51fa\u8bbe\u5907\u7684\u4ea4\u4e92\u6b21\u6570&#xff0c;\u65e8\u5728\u7b80\u5316 Java \u4e2d\u7684\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u64cd\u4f5c\u3002<br \/>\n *\/<br \/>\nclass IoScanner {<br \/>\n    BufferedReader bf;<br \/>\n    StringTokenizer st;<br \/>\n    BufferedWriter bw;<\/p>\n<p>    public IoScanner() {<br \/>\n        bf &#061; new BufferedReader(new InputStreamReader(System.in));<br \/>\n        st &#061; new StringTokenizer(&#034;&#034;);<br \/>\n        bw &#061; new BufferedWriter(new OutputStreamWriter(System.out));<br \/>\n    }<\/p>\n<p>    public String nextLine() throws IOException {<br \/>\n        return bf.readLine();<br \/>\n    }<\/p>\n<p>    public String next() throws IOException {<br \/>\n        while (!st.hasMoreTokens()) {<br \/>\n            st &#061; new StringTokenizer(bf.readLine());<br \/>\n        }<br \/>\n        return st.nextToken();<br \/>\n    }<\/p>\n<p>    public char nextChar() throws IOException {<br \/>\n        return next().charAt(0);<br \/>\n    }<\/p>\n<p>    public int nextInt() throws IOException {<br \/>\n        return Integer.parseInt(next());<br \/>\n    }<\/p>\n<p>    public long nextLong() throws IOException {<br \/>\n        return Long.parseLong(next());<br \/>\n    }<\/p>\n<p>    public double nextDouble() throws IOException {<br \/>\n        return Double.parseDouble(next());<br \/>\n    }<\/p>\n<p>    public float nextFloat() throws IOException {<br \/>\n        return Float.parseFloat(next());<br \/>\n    }<\/p>\n<p>    public BigInteger nextBigInteger() throws IOException {<br \/>\n        return new BigInteger(next());<br \/>\n    }<\/p>\n<p>    public BigDecimal nextDecimal() throws IOException {<br \/>\n        return new BigDecimal(next());<br \/>\n    }<br \/>\n} <\/p>\n<h2 id=\"ymmI0\">D \u5c0f\u7ea2\u7684\u6570\u5b66\u9898<\/h2>\n<p id=\"ufb485d13\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"742\" id=\"u9cdb4ea5\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014918-682fd41e714e0.png\" width=\"795\" \/><\/p>\n<p id=\"u1ad1a05e\">\u6211\u7684\u9996\u5148\u60f3\u5230\u7684\u662f\u97e6\u8fbe\u5b9a\u7406<\/p>\n<p id=\"uce173243\">\u8981\u6c42\u662f x1 x2 \u4e92\u4e0d\u76f8\u540c \u800c\u4e14 x1&#043;x2&#043;x1*x2&#061;&#061;k<\/p>\n<p id=\"ua97bfc63\">\u4e4b\u540e x1&#043;x2 \u4e3a p &#xff0c;x1*x2 \u4e3a q<\/p>\n<p id=\"u713f6284\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1668\" id=\"u639cfa8b\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014918-682fd41ea3bcb.png\" width=\"2388\" \/><\/p>\n<p id=\"u95a7c971\">\u5176\u6b21\u8fdb\u884c\u4e86\u6253\u8868<\/p>\n<p id=\"uea6d6726\">\u83b7\u53d6\u4e86\u5927\u91cf\u6570\u636e<\/p>\n<p id=\"u1316a724\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1080\" id=\"u701d8859\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014920-682fd420314c9.png\" width=\"1918\" \/><\/p>\n<p id=\"u221c8f79\">\u53d1\u73b0\u5947\u6570\u7684\u8bdd \u662f\u4e00\u5b9a\u53ef\u4ee5\u7684 \u53ea\u8981\u6784\u9020\u5176\u4e2d\u4e00\u4e2a\u6570\u4e3a 1 \u5373\u53ef<\/p>\n<p id=\"u85203cc7\">\u63a5\u7740\u662f\u5076\u6570<\/p>\n<p id=\"u466df6e8\">\u6211\u627e\u51fa\u7684\u89c4\u5f8b\u662f\u8fd9\u6837\u7684<\/p>\n<p id=\"ubb84a4e2\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1668\" id=\"ud59a37c6\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014920-682fd420df1dd.png\" width=\"2388\" \/><\/p>\n<p id=\"u9adccdd9\">\u7136\u540e\u6839\u636e\u89c4\u5f8b\u63a8<\/p>\n<p id=\"u899ee1b8\">\u653e\u5927\u5faa\u73af\u7684\u6b21\u6570 \u5c31\u8fc7\u4e86<\/p>\n<p>\/\/ &#064;github https:\/\/github.com\/Dddddduo<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/acm-java-algorithm<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/Dduo-mini-data_structure<br \/>\nimport java.util.*;<br \/>\nimport java.io.*;<br \/>\nimport java.math.*;<br \/>\nimport java.lang.*;<br \/>\nimport java.time.*;<\/p>\n<p>\/**<br \/>\n * \u9898\u76ee\u5730\u5740<br \/>\n *<br \/>\n *\/<\/p>\n<p>\/\/ xixi\u2661\u897f<br \/>\npublic class Main {<\/p>\n<p>    static IoScanner sc &#061; new IoScanner();<br \/>\n    static final int mod &#061; (int) (1e9 &#043; 7);<br \/>\n\/\/    static final int mod &#061; (int) (1e9 &#043; 7);<\/p>\n<p>    static int n;<br \/>\n    static int arr[];<br \/>\n    static boolean visited[];<br \/>\n    static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; adj &#061; new ArrayList&lt;&gt;();<\/p>\n<p>    \/**<br \/>\n     * &#064;throws IOException<br \/>\n     *\/<br \/>\n    private static void solve() throws IOException {<br \/>\n        \/\/ todo<\/p>\n<p>\/\/    TreeSet&lt;Integer&gt;hs&#061;new TreeSet&lt;&gt;();<br \/>\n\/\/    for(int i&#061;1;i&lt;&#061;100;i&#043;&#043;) {<br \/>\n\/\/    for(int j&#061;i&#043;1;j&lt;&#061;100;j&#043;&#043;) {<br \/>\n\/\/    \/\/ k<br \/>\n\/\/    if( (i&#043;j&#043;i*j) %2&#061;&#061;0) {<br \/>\n\/\/    dduoln((i&#043;j)&#043;&#034; &#034;&#043;(i*j)&#043;&#034; &#034;&#043;(i&#043;j&#043;i*j));<br \/>\n\/\/    }<br \/>\n\/\/    hs.add((i&#043;j&#043;i*j));<br \/>\n\/\/    }<br \/>\n\/\/    }<br \/>\n\/\/<br \/>\n\/\/    for(Integer i:hs) {<br \/>\n\/\/    if(i%2&#061;&#061;0) {<br \/>\n\/\/    dduoln(i);<br \/>\n\/\/    }<br \/>\n\/\/    }<\/p>\n<p>    long k&#061;sc.nextLong();<br \/>\n    if(k%2!&#061;0) {<br \/>\n    \/\/ \u5947\u6570<br \/>\n    if(k&#061;&#061;1||k&#061;&#061;3) {<br \/>\n    dduoln(&#034;-1&#034;);<br \/>\n    return;<br \/>\n    }<br \/>\n    long ans1&#061;k-1;<br \/>\n    ans1\/&#061;2;<br \/>\n    long ans2&#061;(1&#043;ans1);<br \/>\n    dduoln((ans1)&#043;&#034; &#034;&#043;(ans2));<br \/>\n    }else {<br \/>\n    \/\/ \u5076\u6570<br \/>\n    long zuobian&#061;14;<br \/>\n    long youbian&#061;6;<\/p>\n<p>    long zuopbianjia&#061;12;<br \/>\n    long youbianjia&#061;4;<\/p>\n<p>    \/\/ todo<br \/>\n    for(int i&#061;0;i&lt;1000000;i&#043;&#043;) {<br \/>\n    if(k-zuobian&lt;0) {<br \/>\n    dduoln(&#034;-1&#034;);<br \/>\n    return;<br \/>\n    }<br \/>\n    long youbianshengxialai&#061;k-zuobian;<br \/>\n    if(youbianshengxialai%youbian&#061;&#061;0) {<br \/>\n    long nn&#061;youbianshengxialai\/youbian;<br \/>\n\/\/    dduoln(nn);<br \/>\n\/\/    dduoln((zuobian-youbian)&#043;&#034; &#034;&#043;nn*(youbian-2));<br \/>\n    dduoln((youbian&#043;2*nn)&#043;&#034; &#034;&#043;((zuobian-youbian)&#043;(nn*(youbian-2))));<br \/>\n    return;<br \/>\n    }<br \/>\n    zuopbianjia&#043;&#061;8;<br \/>\n    zuobian&#043;&#061;zuopbianjia;<br \/>\n    youbian&#043;&#061;youbianjia;<br \/>\n    }<br \/>\n    }<\/p>\n<p>    }<\/p>\n<p>    public static void main(String[] args) throws Exception {<br \/>\n        int t &#061; 1;<br \/>\n\/\/        t &#061; sc.nextInt();<br \/>\n        while (t&#8211; &gt; 0) {<br \/>\n            solve();<br \/>\n        }<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduo(T t) {<br \/>\n        System.out.print(t);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln() {<br \/>\n        System.out.println(&#034;&#034;);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln(T t) {<br \/>\n        System.out.println(t);<br \/>\n    }<br \/>\n}<\/p>\n<p>\/**<br \/>\n * IoScanner\u7c7b<br \/>\n *<br \/>\n * &#064;author Dduo<br \/>\n * &#064;version 1.0<br \/>\n * &#064;description \u901a\u8fc7IO\u6d41\u64cd\u4f5c\u7f13\u51b2\u533a\u51cf\u5c11\u4e86\u4e0e\u5e95\u5c42\u8f93\u5165\u8f93\u51fa\u8bbe\u5907\u7684\u4ea4\u4e92\u6b21\u6570&#xff0c;\u65e8\u5728\u7b80\u5316 Java \u4e2d\u7684\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u64cd\u4f5c\u3002<br \/>\n *\/<br \/>\nclass IoScanner {<br \/>\n    BufferedReader bf;<br \/>\n    StringTokenizer st;<br \/>\n    BufferedWriter bw;<\/p>\n<p>    public IoScanner() {<br \/>\n        bf &#061; new BufferedReader(new InputStreamReader(System.in));<br \/>\n        st &#061; new StringTokenizer(&#034;&#034;);<br \/>\n        bw &#061; new BufferedWriter(new OutputStreamWriter(System.out));<br \/>\n    }<\/p>\n<p>    public String nextLine() throws IOException {<br \/>\n        return bf.readLine();<br \/>\n    }<\/p>\n<p>    public String next() throws IOException {<br \/>\n        while (!st.hasMoreTokens()) {<br \/>\n            st &#061; new StringTokenizer(bf.readLine());<br \/>\n        }<br \/>\n        return st.nextToken();<br \/>\n    }<\/p>\n<p>    public char nextChar() throws IOException {<br \/>\n        return next().charAt(0);<br \/>\n    }<\/p>\n<p>    public int nextInt() throws IOException {<br \/>\n        return Integer.parseInt(next());<br \/>\n    }<\/p>\n<p>    public long nextLong() throws IOException {<br \/>\n        return Long.parseLong(next());<br \/>\n    }<\/p>\n<p>    public double nextDouble() throws IOException {<br \/>\n        return Double.parseDouble(next());<br \/>\n    }<\/p>\n<p>    public float nextFloat() throws IOException {<br \/>\n        return Float.parseFloat(next());<br \/>\n    }<\/p>\n<p>    public BigInteger nextBigInteger() throws IOException {<br \/>\n        return new BigInteger(next());<br \/>\n    }<\/p>\n<p>    public BigDecimal nextDecimal() throws IOException {<br \/>\n        return new BigDecimal(next());<br \/>\n    }<br \/>\n} <\/p>\n<h2 id=\"FQGx2\">E \u5c0f\u7ea2\u7684 ds \u9898<\/h2>\n<p id=\"uf8588e96\">\u6211\u611f\u89c9\u8fd9\u9898\u7684\u96be\u5ea6\u5c0f\u4e8e D<\/p>\n<p id=\"u5aac775c\">\u7ed9\u51fa\u4e8c\u53c9\u6811\u6bcf\u4e00\u5c42\u7684\u8282\u70b9<\/p>\n<p id=\"u49e8c747\">\u7136\u540e\u6784\u9020\u51fa\u4e8c\u53c9\u6811<\/p>\n<p id=\"uadcbdd29\">\u6bcf\u4e2a\u8282\u70b9\u6709 0 \u4e2a 1 \u4e2a 2 \u4e2a\u8282\u70b9<\/p>\n<p id=\"uc57c0d26\">\u6211\u4eec\u76f4\u63a5\u987a\u7740\u5f80\u4e0b\u6784\u9020\u5c31\u884c<\/p>\n<p id=\"u6158449f\">\u76f4\u63a5\u4e00\u5c42\u4e00\u5c42\u63a8<\/p>\n<p id=\"u3ece6174\">\u4ec0\u4e48\u60c5\u51b5\u4e0b\u6784\u9020\u4e0d\u51fa\u6765\u5462<\/p>\n<p id=\"u022f0cf0\">\u5f53\u8fd9\u4e0b\u5c42\u7684\u8282\u70b9\u6570\u5927\u4e8e\u8fd9\u4e00\u5c42\u7684\u4e24\u500d\u65f6\u65e0\u6cd5\u6784\u9020 \u56e0\u4e3a\u8fd9\u4e00\u5c42\u7684\u6bcf\u4e2a\u8282\u70b9\u6700\u591a\u8fde\u4e0b\u4e00\u5c42\u7684\u4e24\u4e2a\u8282\u70b9<\/p>\n<p id=\"u39852767\">\u63a5\u7740\u5c31\u662f\u4e00\u4e2a\u4e2a\u6784\u9020<\/p>\n<p id=\"u1bd2dfed\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1668\" id=\"u7fbc05d0\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014922-682fd42269f93.png\" width=\"2388\" \/><\/p>\n<p>\/\/ &#064;github https:\/\/github.com\/Dddddduo<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/acm-java-algorithm<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/Dduo-mini-data_structure<br \/>\nimport java.util.*;<br \/>\nimport java.io.*;<br \/>\nimport java.math.*;<br \/>\nimport java.lang.*;<br \/>\nimport java.time.*;<\/p>\n<p>\/**<br \/>\n * \u9898\u76ee\u5730\u5740<br \/>\n *<br \/>\n *\/<\/p>\n<p>\/\/ xixi\u2661\u897f<br \/>\npublic class Main {<\/p>\n<p>    static IoScanner sc &#061; new IoScanner();<br \/>\n    static final int mod &#061; (int) (1e9 &#043; 7);<br \/>\n\/\/    static final int mod &#061; (int) (1e9 &#043; 7);<\/p>\n<p>    static int n;<br \/>\n    static int arr[];<br \/>\n    static boolean visited[];<br \/>\n    static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; adj &#061; new ArrayList&lt;&gt;();<\/p>\n<p>    \/**<br \/>\n     * &#064;throws IOException<br \/>\n     *\/<br \/>\n    private static void solve() throws IOException {<br \/>\n        \/\/ todo<br \/>\n    int n&#061;sc.nextInt();<br \/>\n    long arr[]&#061;new long[n&#043;1];<br \/>\n    for(int i&#061;1;i&lt;&#061;n;i&#043;&#043;) {<br \/>\n    arr[i]&#061;sc.nextLong();<br \/>\n    }<\/p>\n<p>    for(int i&#061;2;i&lt;&#061;n;i&#043;&#043;) {<br \/>\n    if( (arr[i]) &gt; (arr[i-1]*2) ) {<br \/>\n    dduoln(&#034;-1&#034;);<br \/>\n    return;<br \/>\n    }<br \/>\n    }<\/p>\n<p>    dduoln(&#034;1&#034;);<\/p>\n<p>    long cnt&#061;2;<\/p>\n<p>    for(int i&#061;1;i&lt;&#061;n;i&#043;&#043;) {<br \/>\n    long ans&#061;arr[i]; \/\/ \u5f53\u524d\u5c42\u6709\u591a\u5c11\u8282\u70b9<br \/>\n    if(i&#061;&#061;n) {<br \/>\n        \/\/ \u6700\u540e\u4e00\u5c42<br \/>\n    for(int j&#061;0;j&lt;ans;j&#043;&#043;) {<br \/>\n    dduoln(&#034;-1 -1&#034;);<br \/>\n    }<br \/>\n    }else {<br \/>\n    \/\/ \u4e0b\u4e00\u5c42\u6709\u591a\u5c11\u4e2a\u8282\u70b9<br \/>\n    long next&#061;arr[i&#043;1];<br \/>\n\/\/    cnt&#043;&#061;ans;<br \/>\n    for(int j&#061;0;j&lt;ans;j&#043;&#043;) {<br \/>\n    if(next&gt;&#061;2) {<br \/>\n        dduo(cnt);<br \/>\n        dduo(&#034; &#034;);<br \/>\n        cnt&#043;&#043;;<br \/>\n        dduoln(cnt);<br \/>\n        cnt&#043;&#043;;<br \/>\n        next-&#061;2;<br \/>\n        }else if(next&#061;&#061;1){<br \/>\n        dduo(cnt);<br \/>\n        dduo(&#034; &#034;);<br \/>\n        cnt&#043;&#043;;<br \/>\n        dduoln(&#034;-1&#034;);<br \/>\n        next-&#061;1;<br \/>\n        }else {<br \/>\n        dduoln(&#034;-1 -1&#034;);<br \/>\n        }<br \/>\n    }<br \/>\n    }<br \/>\n\/\/cnt&#043;&#061;ans;<br \/>\n    }<\/p>\n<p>    }<\/p>\n<p>    public static void main(String[] args) throws Exception {<br \/>\n        int t &#061; 1;<br \/>\n\/\/        t &#061; sc.nextInt();<br \/>\n        while (t&#8211; &gt; 0) {<br \/>\n            solve();<br \/>\n        }<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduo(T t) {<br \/>\n        System.out.print(t);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln() {<br \/>\n        System.out.println(&#034;&#034;);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln(T t) {<br \/>\n        System.out.println(t);<br \/>\n    }<br \/>\n}<\/p>\n<p>\/**<br \/>\n * IoScanner\u7c7b<br \/>\n *<br \/>\n * &#064;author Dduo<br \/>\n * &#064;version 1.0<br \/>\n * &#064;description \u901a\u8fc7IO\u6d41\u64cd\u4f5c\u7f13\u51b2\u533a\u51cf\u5c11\u4e86\u4e0e\u5e95\u5c42\u8f93\u5165\u8f93\u51fa\u8bbe\u5907\u7684\u4ea4\u4e92\u6b21\u6570&#xff0c;\u65e8\u5728\u7b80\u5316 Java \u4e2d\u7684\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u64cd\u4f5c\u3002<br \/>\n *\/<br \/>\nclass IoScanner {<br \/>\n    BufferedReader bf;<br \/>\n    StringTokenizer st;<br \/>\n    BufferedWriter bw;<\/p>\n<p>    public IoScanner() {<br \/>\n        bf &#061; new BufferedReader(new InputStreamReader(System.in));<br \/>\n        st &#061; new StringTokenizer(&#034;&#034;);<br \/>\n        bw &#061; new BufferedWriter(new OutputStreamWriter(System.out));<br \/>\n    }<\/p>\n<p>    public String nextLine() throws IOException {<br \/>\n        return bf.readLine();<br \/>\n    }<\/p>\n<p>    public String next() throws IOException {<br \/>\n        while (!st.hasMoreTokens()) {<br \/>\n            st &#061; new StringTokenizer(bf.readLine());<br \/>\n        }<br \/>\n        return st.nextToken();<br \/>\n    }<\/p>\n<p>    public char nextChar() throws IOException {<br \/>\n        return next().charAt(0);<br \/>\n    }<\/p>\n<p>    public int nextInt() throws IOException {<br \/>\n        return Integer.parseInt(next());<br \/>\n    }<\/p>\n<p>    public long nextLong() throws IOException {<br \/>\n        return Long.parseLong(next());<br \/>\n    }<\/p>\n<p>    public double nextDouble() throws IOException {<br \/>\n        return Double.parseDouble(next());<br \/>\n    }<\/p>\n<p>    public float nextFloat() throws IOException {<br \/>\n        return Float.parseFloat(next());<br \/>\n    }<\/p>\n<p>    public BigInteger nextBigInteger() throws IOException {<br \/>\n        return new BigInteger(next());<br \/>\n    }<\/p>\n<p>    public BigDecimal nextDecimal() throws IOException {<br \/>\n        return new BigDecimal(next());<br \/>\n    }<br \/>\n} <\/p>\n<h2 id=\"ITXXu\">F \u5c0f\u7ea2\u7684\u5c0f\u82ef\u9898<\/h2>\n<p id=\"ue45d5a4a\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"756\" id=\"u39cfb3bd\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014923-682fd423eb801.png\" width=\"795\" \/><\/p>\n<p id=\"ue7ace83c\">\u6784\u9020\u4e00\u4e2a\u77e9\u9635 \u6bcf\u884c\u6bcf\u5217\u7684\u5f02\u6216\u548c\u6784\u6210\u6392\u5217<\/p>\n<p id=\"u68af24fa\">\u8fd9\u6837\u6784\u9020 \u7136\u540e\u6b63\u597d\u8981\u6ee1\u8db3\u8fd9\u4e2a\u60c5\u51b5<\/p>\n<p id=\"ubf13b88c\">\u5c31\u662f \u884c\u52a0\u5217%4&#061;&#061;3<\/p>\n<p id=\"u4f348f08\">\u5f88\u5947\u5999&#xff01;<\/p>\n<p id=\"u1444c7dc\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"433\" id=\"u194e9896\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014924-682fd424303b4.png\" width=\"290\" \/><\/p>\n<p>\/\/ &#064;github https:\/\/github.com\/Dddddduo<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/acm-java-algorithm<br \/>\n\/\/ &#064;github https:\/\/github.com\/Dddddduo\/Dduo-mini-data_structure<br \/>\nimport java.util.*;<br \/>\nimport java.io.*;<br \/>\nimport java.math.*;<br \/>\nimport java.lang.*;<br \/>\nimport java.time.*;<\/p>\n<p>\/**<br \/>\n * \u9898\u76ee\u5730\u5740<br \/>\n *<br \/>\n *\/<\/p>\n<p>\/\/ xixi\u2661\u897f<br \/>\npublic class Main {<\/p>\n<p>    static IoScanner sc &#061; new IoScanner();<br \/>\n    static final int mod &#061; (int) (1e9 &#043; 7);<br \/>\n\/\/    static final int mod &#061; (int) (1e9 &#043; 7);<\/p>\n<p>    static int n;<br \/>\n    static int arr[];<br \/>\n    static boolean visited[];<br \/>\n    static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; adj &#061; new ArrayList&lt;&gt;();<\/p>\n<p>    \/**<br \/>\n     * &#064;throws IOException<br \/>\n     *\/<\/p>\n<p>    \/\/ 2 5<br \/>\n    \/\/ 0 0 0 0 7<br \/>\n    \/\/ 1 2 3 4 2<br \/>\n    private static void solve() throws IOException {<br \/>\n        \/\/ todo<br \/>\n      int n &#061; sc.nextInt();<br \/>\n          int m &#061; sc.nextInt();<br \/>\n          int k &#061; n &#043; m;<\/p>\n<p>          if (k % 4 !&#061; 3) {<br \/>\n              dduoln(&#034;-1&#034;);<br \/>\n              return;<br \/>\n          }<\/p>\n<p>          \/\/ \u884c<br \/>\n          int[] rows &#061; new int[n];<br \/>\n          for (int i &#061; 0; i &lt; n; i&#043;&#043;) {<br \/>\n              rows[i] &#061; k &#8211; i;<br \/>\n          }<\/p>\n<p>          \/\/ \u5217<br \/>\n          int[] cols &#061; new int[m];<br \/>\n          for (int i &#061; 0; i &lt; m; i&#043;&#043;) {<br \/>\n              cols[i] &#061; i &#043; 1;<br \/>\n          }<\/p>\n<p>          int[][] arr &#061; new int[n][m];<br \/>\n          for (int i &#061; 0; i &lt; n &#8211; 1; i&#043;&#043;) {<br \/>\n              for (int j &#061; 0; j &lt; m &#8211; 1; j&#043;&#043;) {<br \/>\n              arr[i][j] &#061; 0;<br \/>\n              }<br \/>\n              arr[i][m &#8211; 1] &#061; rows[i];<br \/>\n          }<\/p>\n<p>          if (m &#061;&#061; 0) {<br \/>\n          dduoln(&#034;-1&#034;);<br \/>\n              return;<br \/>\n          }<\/p>\n<p>          \/\/ \u5217\u5904\u7406<br \/>\n          for (int j &#061; 0; j &lt; m &#8211; 1; j&#043;&#043;) {<br \/>\n          arr[n &#8211; 1][j] &#061; cols[j];<br \/>\n          }<\/p>\n<p>          int ans &#061; 0;<br \/>\n          for (int i &#061; 0; i &lt; n &#8211; 1; i&#043;&#043;) {<br \/>\n          ans ^&#061; rows[i];<br \/>\n          }<\/p>\n<p>          int x &#061; cols[m &#8211; 1] ^ ans;<br \/>\n          arr[n &#8211; 1][m &#8211; 1] &#061; x;<\/p>\n<p>          for (int i &#061; 0; i &lt; n; i&#043;&#043;) {<br \/>\n              int xor &#061; 0;<br \/>\n              for (int num : arr[i]) {<br \/>\n                  xor ^&#061; num;<br \/>\n              }<br \/>\n              assert xor &#061;&#061; rows[i] : &#034;Row &#034; &#043; i &#043; &#034; xor error&#034;;<br \/>\n          }<\/p>\n<p>          for (int j &#061; 0; j &lt; m; j&#043;&#043;) {<br \/>\n              int xor &#061; 0;<br \/>\n              for (int i &#061; 0; i &lt; n; i&#043;&#043;) {<br \/>\n                  xor ^&#061; arr[i][j];<br \/>\n              }<br \/>\n              assert xor &#061;&#061; cols[j] : &#034;Col &#034; &#043; j &#043; &#034; xor error&#034;;<br \/>\n          }<\/p>\n<p>          for (int[] row : arr) {<br \/>\n              StringBuilder sb &#061; new StringBuilder();<br \/>\n              for (int num : row) {<br \/>\n                  sb.append(num).append(&#034; &#034;);<br \/>\n              }<br \/>\n              dduoln(sb.toString());<br \/>\n          }<\/p>\n<p>    }<\/p>\n<p>    public static void main(String[] args) throws Exception {<br \/>\n        int t &#061; 1;<br \/>\n\/\/        t &#061; sc.nextInt();<br \/>\n        while (t&#8211; &gt; 0) {<br \/>\n            solve();<br \/>\n        }<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduo(T t) {<br \/>\n        System.out.print(t);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln() {<br \/>\n        System.out.println(&#034;&#034;);<br \/>\n    }<\/p>\n<p>    static &lt;T&gt; void dduoln(T t) {<br \/>\n        System.out.println(t);<br \/>\n    }<br \/>\n}<\/p>\n<p>\/**<br \/>\n * IoScanner\u7c7b<br \/>\n *<br \/>\n * &#064;author Dduo<br \/>\n * &#064;version 1.0<br \/>\n * &#064;description \u901a\u8fc7IO\u6d41\u64cd\u4f5c\u7f13\u51b2\u533a\u51cf\u5c11\u4e86\u4e0e\u5e95\u5c42\u8f93\u5165\u8f93\u51fa\u8bbe\u5907\u7684\u4ea4\u4e92\u6b21\u6570&#xff0c;\u65e8\u5728\u7b80\u5316 Java \u4e2d\u7684\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u64cd\u4f5c\u3002<br \/>\n *\/<br \/>\nclass IoScanner {<br \/>\n    BufferedReader bf;<br \/>\n    StringTokenizer st;<br \/>\n    BufferedWriter bw;<\/p>\n<p>    public IoScanner() {<br \/>\n        bf &#061; new BufferedReader(new InputStreamReader(System.in));<br \/>\n        st &#061; new StringTokenizer(&#034;&#034;);<br \/>\n        bw &#061; new BufferedWriter(new OutputStreamWriter(System.out));<br \/>\n    }<\/p>\n<p>    public String nextLine() throws IOException {<br \/>\n        return bf.readLine();<br \/>\n    }<\/p>\n<p>    public String next() throws IOException {<br \/>\n        while (!st.hasMoreTokens()) {<br \/>\n            st &#061; new StringTokenizer(bf.readLine());<br \/>\n        }<br \/>\n        return st.nextToken();<br \/>\n    }<\/p>\n<p>    public char nextChar() throws IOException {<br \/>\n        return next().charAt(0);<br \/>\n    }<\/p>\n<p>    public int nextInt() throws IOException {<br \/>\n        return Integer.parseInt(next());<br \/>\n    }<\/p>\n<p>    public long nextLong() throws IOException {<br \/>\n        return Long.parseLong(next());<br \/>\n    }<\/p>\n<p>    public double nextDouble() throws IOException {<br \/>\n        return Double.parseDouble(next());<br \/>\n    }<\/p>\n<p>    public float nextFloat() throws IOException {<br \/>\n        return Float.parseFloat(next());<br \/>\n    }<\/p>\n<p>    public BigInteger nextBigInteger() throws IOException {<br \/>\n        return new BigInteger(next());<br \/>\n    }<\/p>\n<p>    public BigDecimal nextDecimal() throws IOException {<br \/>\n        return new BigDecimal(next());<br \/>\n    }<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb731\u6b21\uff0c\u70b9\u8d5e3\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u516d\u4e2a\u7f16\u7a0b\u9898\u76ee\u53ca\u5176\u89e3\u51b3\u65b9\u6848\uff0c\u6d89\u53ca\u7b7e\u5230\u9898\u3001\u6a21\u62df\u9898\u3001\u6570\u5b66\u9898\u3001\u6570\u636e\u7ed3\u6784\u9898\u7b49\u3002\u6bcf\u4e2a\u9898\u76ee\u90fd\u63d0\u4f9b\u4e86\u8be6\u7ec6\u7684Java\u4ee3\u7801\u5b9e\u73b0\uff0c\u6db5\u76d6\u4e86\u4ece\u7b80\u5355\u6784\u9020\u5230\u590d\u6742\u7b97\u6cd5\u7684\u591a\u79cd\u7f16\u7a0b\u6280\u5de7\u3002\u4f8b\u5982\uff0c\u7b7e\u5230\u9898\u901a\u8fc7\u7b80\u5355\u7684\u5b57\u7b26\u4e32\u6784\u9020\u89e3\u51b3\uff0c\u6a21\u62df\u9898\u901a\u8fc7\u8def\u5f84\u89c4\u5212\u907f\u514d\u9677\u9631\uff0c\u6570\u5b66\u9898\u5229\u7528\u97e6\u8fbe\u5b9a\u7406\u548c\u6253\u8868\u6cd5\u5bfb\u627e\u89c4\u5f8b\uff0c\u6570\u636e\u7ed3\u6784\u9898\u5219\u901a\u8fc7\u9010\u5c42\u6784\u9020\u4e8c\u53c9\u6811\u6765\u89e3\u51b3\u95ee\u9898\u3002\u8fd9\u4e9b\u9898\u76ee\u5c55\u793a\u4e86\u5982\u4f55\u901a\u8fc7\u4e0d\u540c\u7684\u7f16\u7a0b\u601d\u8def\u548c\u7b97\u6cd5\u6280\u5de7\u6765\u89e3\u51b3\u5b9e\u9645\u95ee\u9898\uff0c\u9002\u5408\u7f16\u7a0b\u7ade\u8d5b\u548c\u7b97\u6cd5\u5b66\u4e60\u7684\u53c2\u8003\u3002<\/p>\n","protected":false},"author":2,"featured_media":39320,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3517,99,114,768,3519,3520,190,100,427,3518],"topic":[],"class_list":["post-39329","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-3517","tag-java","tag-mysql","tag-sql","tag-web","tag-3520","tag-190","tag-100","tag-427","tag-3518"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u725b\u5ba2\u5468\u8d5b Round 92 \u9898\u89e3 Java - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/39329.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u725b\u5ba2\u5468\u8d5b Round 92 \u9898\u89e3 Java - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb731\u6b21\uff0c\u70b9\u8d5e3\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u516d\u4e2a\u7f16\u7a0b\u9898\u76ee\u53ca\u5176\u89e3\u51b3\u65b9\u6848\uff0c\u6d89\u53ca\u7b7e\u5230\u9898\u3001\u6a21\u62df\u9898\u3001\u6570\u5b66\u9898\u3001\u6570\u636e\u7ed3\u6784\u9898\u7b49\u3002\u6bcf\u4e2a\u9898\u76ee\u90fd\u63d0\u4f9b\u4e86\u8be6\u7ec6\u7684Java\u4ee3\u7801\u5b9e\u73b0\uff0c\u6db5\u76d6\u4e86\u4ece\u7b80\u5355\u6784\u9020\u5230\u590d\u6742\u7b97\u6cd5\u7684\u591a\u79cd\u7f16\u7a0b\u6280\u5de7\u3002\u4f8b\u5982\uff0c\u7b7e\u5230\u9898\u901a\u8fc7\u7b80\u5355\u7684\u5b57\u7b26\u4e32\u6784\u9020\u89e3\u51b3\uff0c\u6a21\u62df\u9898\u901a\u8fc7\u8def\u5f84\u89c4\u5212\u907f\u514d\u9677\u9631\uff0c\u6570\u5b66\u9898\u5229\u7528\u97e6\u8fbe\u5b9a\u7406\u548c\u6253\u8868\u6cd5\u5bfb\u627e\u89c4\u5f8b\uff0c\u6570\u636e\u7ed3\u6784\u9898\u5219\u901a\u8fc7\u9010\u5c42\u6784\u9020\u4e8c\u53c9\u6811\u6765\u89e3\u51b3\u95ee\u9898\u3002\u8fd9\u4e9b\u9898\u76ee\u5c55\u793a\u4e86\u5982\u4f55\u901a\u8fc7\u4e0d\u540c\u7684\u7f16\u7a0b\u601d\u8def\u548c\u7b97\u6cd5\u6280\u5de7\u6765\u89e3\u51b3\u5b9e\u9645\u95ee\u9898\uff0c\u9002\u5408\u7f16\u7a0b\u7ade\u8d5b\u548c\u7b97\u6cd5\u5b66\u4e60\u7684\u53c2\u8003\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/39329.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-23T01:49:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014918-682fd41e48f2f.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/39329.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/39329.html\",\"name\":\"\u725b\u5ba2\u5468\u8d5b Round 92 \u9898\u89e3 Java - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-23T01:49:25+00:00\",\"dateModified\":\"2025-05-23T01:49:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/39329.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/39329.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/39329.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u725b\u5ba2\u5468\u8d5b Round 92 \u9898\u89e3 Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u725b\u5ba2\u5468\u8d5b Round 92 \u9898\u89e3 Java - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/39329.html","og_locale":"zh_CN","og_type":"article","og_title":"\u725b\u5ba2\u5468\u8d5b Round 92 \u9898\u89e3 Java - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb731\u6b21\uff0c\u70b9\u8d5e3\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u516d\u4e2a\u7f16\u7a0b\u9898\u76ee\u53ca\u5176\u89e3\u51b3\u65b9\u6848\uff0c\u6d89\u53ca\u7b7e\u5230\u9898\u3001\u6a21\u62df\u9898\u3001\u6570\u5b66\u9898\u3001\u6570\u636e\u7ed3\u6784\u9898\u7b49\u3002\u6bcf\u4e2a\u9898\u76ee\u90fd\u63d0\u4f9b\u4e86\u8be6\u7ec6\u7684Java\u4ee3\u7801\u5b9e\u73b0\uff0c\u6db5\u76d6\u4e86\u4ece\u7b80\u5355\u6784\u9020\u5230\u590d\u6742\u7b97\u6cd5\u7684\u591a\u79cd\u7f16\u7a0b\u6280\u5de7\u3002\u4f8b\u5982\uff0c\u7b7e\u5230\u9898\u901a\u8fc7\u7b80\u5355\u7684\u5b57\u7b26\u4e32\u6784\u9020\u89e3\u51b3\uff0c\u6a21\u62df\u9898\u901a\u8fc7\u8def\u5f84\u89c4\u5212\u907f\u514d\u9677\u9631\uff0c\u6570\u5b66\u9898\u5229\u7528\u97e6\u8fbe\u5b9a\u7406\u548c\u6253\u8868\u6cd5\u5bfb\u627e\u89c4\u5f8b\uff0c\u6570\u636e\u7ed3\u6784\u9898\u5219\u901a\u8fc7\u9010\u5c42\u6784\u9020\u4e8c\u53c9\u6811\u6765\u89e3\u51b3\u95ee\u9898\u3002\u8fd9\u4e9b\u9898\u76ee\u5c55\u793a\u4e86\u5982\u4f55\u901a\u8fc7\u4e0d\u540c\u7684\u7f16\u7a0b\u601d\u8def\u548c\u7b97\u6cd5\u6280\u5de7\u6765\u89e3\u51b3\u5b9e\u9645\u95ee\u9898\uff0c\u9002\u5408\u7f16\u7a0b\u7ade\u8d5b\u548c\u7b97\u6cd5\u5b66\u4e60\u7684\u53c2\u8003\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/39329.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-23T01:49:25+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250523014918-682fd41e48f2f.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"11 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/39329.html","url":"https:\/\/www.wsisp.com\/helps\/39329.html","name":"\u725b\u5ba2\u5468\u8d5b Round 92 \u9898\u89e3 Java - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-23T01:49:25+00:00","dateModified":"2025-05-23T01:49:25+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/39329.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/39329.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/39329.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u725b\u5ba2\u5468\u8d5b Round 92 \u9898\u89e3 Java"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/39329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=39329"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/39329\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/39320"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=39329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=39329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=39329"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=39329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}