Fork me on GitHub

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

posted @ 2016-08-31 09:55  CC11001100  阅读(187)  评论(0编辑  收藏  举报