hdu2501

#include<bits/stdc++.h>
#include<iostream> 
#define LL long long
#define GG int 
#define For(i, j, k) for(int i=j; i<=k; i++)
#define Dow(i, j, k) for(int i=j; i>=k; i--)

inline GG read() {
    GG x = 0, f = 1;
    char ch = getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') f = -1; ch = getchar(); }
    while(ch>='0'&&ch<='9') { x = x*10+ch-48; ch = getchar(); }
    return x * f;
}

const int N =  10; 
int n, m, num; 
LL f[1000], t1; 

int main() {
	int T; 
	scanf("%d", &T);
	f[1] = 1; f[2] = 3; 
	For(i, 3, 50) f[i] = f[i-1]+2*f[i-2];
	while(T--) {
		scanf("%d", &n);
		printf("%lld\n", f[n]); 
	} 
	return 0; 
}
 

       

 

上一篇:作为普通Ruby开发,我如何从零转型机器学习


下一篇:数据价值挖掘利器!阿里云实时数仓AnalyticDB PG版新一代计算引擎Odyssey技术解析