• 算法训练 图形显示


      算法训练 图形显示  
    时间限制:1.0s   内存限制:512.0MB
        
    问题描述
      编写一个程序,首先输入一个整数,例如5,然后在屏幕上显示如下的图形(5表示行数):
      * * * * *
      * * * *
      * * *
      * *
      *
     
    import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            Scanner sc=new Scanner(System.in);
            int n=sc.nextInt();
            for(int i=n;i>=1;i--){
                for(int j=1;j<=i;j++){
                    System.out.print("* ");
                }
                System.out.println();
            }
    
        }
    
    }
  • 相关阅读:
    改造二叉树
    汽车加油行驶问题
    [SHOI2012]回家的路
    子串
    P3558 [POI2013]BAJ-Bytecomputer
    HDU
    UVALive
    ZOJ
    HDU
    牛客小白月赛2 题解
  • 原文地址:https://www.cnblogs.com/watchfree/p/5326379.html
Copyright © 2020-2023  润新知