본문 바로가기

알고리즘/문제 풀이

SW Expert Academy 2019. 더블더블

SW Expert Academy

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

import java.util.ArrayList;
import java.util.Scanner;

public class Solution {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int result = 1;
        for (int i = 0; i <= a; i++) {
            if(i == 0){
                System.out.print(result + " ");
                continue;
            }
            result *= 2;
            System.out.print(result + " ");
        }

    }

}