From a188dd297680e1955568444f4d2c14955cb1b02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=9B=E9=AA=8F=E6=B4=8B?= <836157478@qq.com> Date: Sat, 5 Aug 2023 08:28:01 +0000 Subject: [PATCH] =?UTF-8?q?update=20problems/0013.=E9=95=82=E7=A9=BA?= =?UTF-8?q?=E4=B8=89=E8=A7=92=E5=BD=A2.md.=20=E6=B7=BB=E5=8A=A0=E4=BA=86ja?= =?UTF-8?q?va=E7=89=88=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=B9=B6=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E4=BA=86python=E4=BB=A3=E7=A0=81=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=88=E4=B9=8B=E5=89=8D=E5=86=99=E5=88=B0java=E4=B8=8A?= =?UTF-8?q?=E4=BA=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 盛骏洋 <836157478@qq.com> --- ...72\344\270\211\350\247\222\345\275\242.md" | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git "a/problems/0013.\351\225\202\347\251\272\344\270\211\350\247\222\345\275\242.md" "b/problems/0013.\351\225\202\347\251\272\344\270\211\350\247\222\345\275\242.md" index bfe0d6e..d7e25b2 100644 --- "a/problems/0013.\351\225\202\347\251\272\344\270\211\350\247\222\345\275\242.md" +++ "b/problems/0013.\351\225\202\347\251\272\344\270\211\350\247\222\345\275\242.md" @@ -50,7 +50,43 @@ int main() { ``` ## Java +```java +import java.util.Scanner; +public class Main{ + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + while (in.hasNextLine()) { + String line = in.nextLine(); + char x = line.charAt(0); + if (x == '@') break; + int n = Integer.valueOf(line.substring(2)); + for (int i = 1; i <= n; i++) { + for (int j = 0; j < n - i; j++) { + System.out.print(" ");//空格 + } + if (i == 1) System.out.println(x); + else if (i > 1 && i < n) { + System.out.print(x); + for (int j = 0; j < 2 * (i - 1) - 1; j++) { + System.out.print(" "); //镂空的空格 + } + System.out.println(x); + } else if (i == n) { + for (int j = 0; j < 2 * n - 1; j++) { + System.out.print(x); + } + System.out.println(); + } + } + System.out.println(); //忘记加了格式错误很多次。。 + } + } +} + +``` + +## python ```python while True: try: @@ -71,8 +107,6 @@ while True: except: ``` -## python - ## Go ## Js -- Gitee