한 노 타 IV --- hdu 2077

제목 링크:http://acm.hdu.edu.cn/showproblem.php?pid=2077
 
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define N 25

int main()
{
    int a[N]={0, 2};///       ,              ;
    int b[N]={0, 1};///             ;
    int c[N]={0, 2};///    ;

    int i;

    for(i=2; i<21; i++)
        a[i] = 3*a[i-1]+2;
    for(i=2; i<21; i++)
        b[i] = a[i-1]+1+b[i-1];
    for(i=2; i<21; i++)
        c[i] = 2*b[i-1]+2;

    int T, n;

    scanf("%d", &T);

    while(T--)
    {
        scanf("%d", &n);
        printf("%d
", c[n]); } return 0; }

좋은 웹페이지 즐겨찾기