NYOJ题目836画图

-------------------------------------

AC代码:

 1 import java.util.Scanner;
 2 
 3 public class Main {
 4 
 5     public static void main(String[] args) {
 6         
 7         Scanner sc=new Scanner(System.in);
 8         
 9         int times=sc.nextInt();
10         
11         while(times-->0){
12             int n=sc.nextInt();
13             for(int i=n;i>0;i--){
14                 System.out.println(repeate("*",i));
15             }
16         }
17     }
18     
19     public static String repeate(String s,int times){
20         StringBuilder sb=new StringBuilder(s.length()*times);
21         while(times-->0) sb.append(s);
22         return sb.toString();
23     }
24     
25 }

 

题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=836

相关文章:

  • 2022-02-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-14
  • 2022-02-05
  • 2021-11-10
  • 2021-05-28
  • 2021-09-22
猜你喜欢
  • 2021-07-02
  • 2021-05-24
  • 2022-03-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案