Fork me on GitHub

NYOJ题目822画图

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

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 n=sc.nextInt();
10         for(int i=0;i<n;i++){
11             System.out.println(repeate("*",n));
12         }
13         
14     }
15     
16     public static String repeate(String s,int times){
17         StringBuilder sb=new StringBuilder(s.length()*times);
18         while(times-->0) sb.append(s);
19         return sb.toString();
20     }
21     
22 }

 

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

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