fork download
  1. /*問題10 教科書 演習4-23*/
  2.  
  3. import java.util.*;
  4.  
  5. class Mondai109509 {
  6. public static void main (String[] args) {
  7. Scanner stdIn = new Scanner(System.in);
  8. int n = 0, cnt = 0;
  9.  
  10. for (int i = 0; i <= 0;) {
  11. System.out.println("何段表示しますか>");
  12. i = stdIn.nextInt();
  13. n = i;
  14. cnt = n;
  15. }
  16. for (int i = 1; i <= n; i++) {
  17. for (int k = 0; k < cnt - 1; k++) {
  18. System.out.print(" ");
  19. }
  20. for (int j = 0; j < i * 2 - 1; j++) {
  21. System.out.print(i % 10);
  22. }
  23. cnt--;
  24. System.out.println();
  25. }
  26. }
  27. }
Success #stdin #stdout 0.28s 321088KB
stdin
100
stdout
何段表示しますか>
                                                                                                   1
                                                                                                  222
                                                                                                 33333
                                                                                                4444444
                                                                                               555555555
                                                                                              66666666666
                                                                                             7777777777777
                                                                                            888888888888888
                                                                                           99999999999999999
                                                                                          0000000000000000000
                                                                                         111111111111111111111
                                                                                        22222222222222222222222
                                                                                       3333333333333333333333333
                                                                                      444444444444444444444444444
                                                                                     55555555555555555555555555555
                                                                                    6666666666666666666666666666666
                                                                                   777777777777777777777777777777777
                                                                                  88888888888888888888888888888888888
                                                                                 9999999999999999999999999999999999999
                                                                                000000000000000000000000000000000000000
                                                                               11111111111111111111111111111111111111111
                                                                              2222222222222222222222222222222222222222222
                                                                             333333333333333333333333333333333333333333333
                                                                            44444444444444444444444444444444444444444444444
                                                                           5555555555555555555555555555555555555555555555555
                                                                          666666666666666666666666666666666666666666666666666
                                                                         77777777777777777777777777777777777777777777777777777
                                                                        8888888888888888888888888888888888888888888888888888888
                                                                       999999999999999999999999999999999999999999999999999999999
                                                                      00000000000000000000000000000000000000000000000000000000000
                                                                     1111111111111111111111111111111111111111111111111111111111111
                                                                    222222222222222222222222222222222222222222222222222222222222222
                                                                   33333333333333333333333333333333333333333333333333333333333333333
                                                                  4444444444444444444444444444444444444444444444444444444444444444444
                                                                 555555555555555555555555555555555555555555555555555555555555555555555
                                                                66666666666666666666666666666666666666666666666666666666666666666666666
                                                               7777777777777777777777777777777777777777777777777777777777777777777777777
                                                              888888888888888888888888888888888888888888888888888888888888888888888888888
                                                             99999999999999999999999999999999999999999999999999999999999999999999999999999
                                                            0000000000000000000000000000000000000000000000000000000000000000000000000000000
                                                           111111111111111111111111111111111111111111111111111111111111111111111111111111111
                                                          22222222222222222222222222222222222222222222222222222222222222222222222222222222222
                                                         3333333333333333333333333333333333333333333333333333333333333333333333333333333333333
                                                        444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
                                                       55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555
                                                      6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
                                                     777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
                                                    88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
                                                   9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
                                                  000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                                                 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
                                                2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
                                               333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
                                              44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
                                             5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555
                                            666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
                                           77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
                                          8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
                                         999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
                                        00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                                       1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
                                      222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
                                     33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
                                    4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
                                   555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555
                                  66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
                                 7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
                                888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
                               99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
                              0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                             111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
                            22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
                           3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
                          444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
                         55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555
                        6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
                       777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
                      88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
                     9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
                    000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                   11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
                  2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
                 333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
                44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
               5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555
              666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
             77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
            8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
           999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
          00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
         1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
        222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
       33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
      4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
     555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555
    66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
   7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
  888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000