페이지

9546번: 3000번 버스

https://www.acmicpc.net/problem/9546


$O(t)$

2^k-1이다. 이는 수학적 귀납법으로 증명된다.


#include<cstdio>
int t, k;
int main() {
    for (scanf("%d", &t); t--;)
        scanf("%d", &k), printf("%d\n", (1 << k) - 1);
    return 0;
}

댓글 없음 :

댓글 쓰기