View Code of Problem 60

#include<stdio.h>
#include<math.h>
#include <string.h>
int main(){
	long long dp[41];
	dp[0] = 2;
	dp[1] = 3;
	for(int i=2; i<41; i++){
		dp[i] = dp[i-1] + dp[i-2];
	}
	
	int t;
	scanf("%d", &t);
	int cnt = 1;
	while(t--) {
		int s; //二进制数的位数s
		scanf("%d", &s);
		printf("Scenario #%d:\n", cnt++); //i+1是序号 
		printf("%lld\n", dp[s-1]);
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 60