SWEA 2019 더블더블

1 개요[ | ]

SWEA 2019 더블더블

2 C++[ | ]

#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int t = 1;
    for(int i=0; i<=n ;i++) {
        cout << t << " ";
        t *= 2;
    }
}

3 Java[ | ]

import java.util.Scanner;
class Solution {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int i=0; i<=n; i++) {
            System.out.format("%d ", (int)Math.pow(2, i) );  
        }
    }
}

4 Python[ | ]

#kcy
a = int(input())
for i in range(0, a+1):
    print(2**i,end=' ')
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}