From 6f64245f7c9d4ae659490914ef51b1f2a79d3b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=9B=E9=AA=8F=E6=B4=8B?= <836157478@qq.com> Date: Sun, 6 Aug 2023 02:17:52 +0000 Subject: [PATCH] =?UTF-8?q?update=20problems/0015.=E7=A5=9E=E7=A7=98?= =?UTF-8?q?=E5=AD=97=E7=AC=A6.md.=20=E6=B7=BB=E5=8A=A0=E4=BA=86Java?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=80=9D=E8=B7=AF2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 盛骏洋 <836157478@qq.com> --- ...236\347\247\230\345\255\227\347\254\246.md" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git "a/problems/0015.\347\245\236\347\247\230\345\255\227\347\254\246.md" "b/problems/0015.\347\245\236\347\247\230\345\255\227\347\254\246.md" index 2d0c8ed..c27a300 100644 --- "a/problems/0015.\347\245\236\347\247\230\345\255\227\347\254\246.md" +++ "b/problems/0015.\347\245\236\347\247\230\345\255\227\347\254\246.md" @@ -60,6 +60,24 @@ public class Main { } } ``` +### Java思路2 +```java +import java.util.Scanner; + +public class Main{ + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int n = in.nextInt(); + for (int i = 0; i < n; i++) { + String a = in.next(); + String b = in.next(); + StringBuilder sb = new StringBuilder(a); + sb.insert(a.length() / 2, b); + System.out.println(sb.toString()); + } + } +} +``` ## python ```python -- Gitee