SGU_123
斐波那契数列前n项和为2*F(n+1)-F(n-1)-1。
#include<stdio.h>
#include<string.h>
long long int f[50];
int main()
{
int i, j, k;
f[0] = 0, f[1] = 1;
for(i = 2; i <= 41; i ++)
f[i] = f[i - 1] + f[i - 2];
while(scanf("%d", &k) == 1)
printf("%d\n", f[k + 1] - f[k - 1] - 1 + f[k + 1]);
return 0;
}