Eli is a teenager who loves to study chemistry. She recently joined a chemistry research lab.
Dr. Phil wants her to just play around with some chemicals and observe their reaction.
Therefore, he gave her a one-row tray of test tubes with the different chemical inside of them
and told her:
"Mix these chemical together anyhow that you like, but the you have to follow two rules:
Never make a mixture that has two chemicals that their tubes are next to each other.
Keep adding more chemical to the mixture until it is not violating the new rule. "
For example, in the image you can see she was given 5 tubes and she is able to make 4
different mixture without violating the rule: {1,3,5},\ {2,4},\ {2,5},\ {1,4}\ .{1,3,5}, {2,4}, {2,5}, {1,4} .
But she cannot mix 1 and 3 only because she still can add 5 without violating the rules.
She is curious to know how many different mixtures she can make without violating the rule with any
given number of tubes. That’s why she asks you write a code to calculate it for her.
#include<stdio.h>
#define LASTSUBSCRIPT 80
int main(){
long long int a[80]={0,0,0,1,2,2,3},T;
for(int temp = 7;temp <= LASTSUBSCRIPT;temp++)
a[temp] = a[temp-2]+a[temp-3];
int N,count=1;
while(~scanf("%d",&N)){
if(N==0) break;
printf("Case #%d: %lld\n",count++,a[N]+a[N-1]);
}
return 0;
}
先打表然后跑