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 bfe0d6ea7a9a25d6c1da445165a647eacdfab8f6..d7e25b23af6595b356101a59e14e4e8f1496e7ef 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