#include <stdio.h>
int c=0;
int rec(int n){
c++;
if(n==1){
return 1;
}
else if(n==2){
return 2;
}
else{
return -6*rec(n-1)-9*rec(n-2);
}
}
int main(void) {
int n;
printf("数列a%dの値は%d\n", n
, rec
(n
)); printf("このときrecの呼び出し回数は%d",c
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CmludCBjPTA7CmludCByZWMoaW50IG4pewpjKys7CmlmKG49PTEpewpyZXR1cm4gMTsKfQplbHNlIGlmKG49PTIpewpyZXR1cm4gMjsKfQplbHNlewpyZXR1cm4gLTYqcmVjKG4tMSktOSpyZWMobi0yKTsKfQp9CmludCBtYWluKHZvaWQpIHsKaW50IG47CnNjYW5mKCIlZCIsJm4pOwpwcmludGYoIuaVsOWIl2ElZOOBruWApOOBryVkXG4iLCBuLCByZWMobikpOwpwcmludGYoIuOBk+OBruOBqOOBjXJlY+OBruWRvOOBs+WHuuOBl+WbnuaVsOOBryVkIixjKTsKcmV0dXJuIDA7Cn0KCg==