View Code of Problem 60

#include<stdio.h>
//二刷 

long long dp[41];
void Initial(){
	dp[0] = 2;
	dp[1] = 3;
	for(int i=2; i<41; i++){
		dp[i] = dp[i-1] + dp[i-2];
	}
	return;
} 

int main() {
	Initial();
	int t;
	scanf("%d", &t);
	for(int i=0; i<t; i++){
		int s; //二进制数的位数s
		scanf("%d", &s);
		printf("Scenario #%d:\n", i+1); //i+1是序号 
		printf("%lld\n", dp[s-1]);
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 60