알고리즘/백준 알고리즘

[java] 백준 알고리즘 2439번 별찍기 - 2 풀이

희랍인 조르바 2018. 5. 12. 16:36

간단한거라 설명은 생략.




* 풀이소스


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class Baekjoon2439 {
 
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int n = Integer.parseInt(br.readLine());
        
        for(int i=n; i>=1; i--){
            String star = "";
            for(int j=1; j<=n; j++){
                
                if(i>j){
                    star += " ";
                }else{
                    star += "*";
                }
            }
            
            System.out.println(star);
        }
    }
 
}
 
cs