#include <stdio.h>
//練習問題D
int func(int n){
if(n==0){
return -1;
}else{
return 3*func(n-1)+5;
}
}
int main(void) {
int n = 3, m;
m = func(n);
printf("数列anについて, n=%dのときの値は%d\n", n
, m
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Ci8v57e057+S5ZWP6aGMRAppbnQgZnVuYyhpbnQgbil7CiAgICBpZihuPT0wKXsKICAgIAlyZXR1cm4gLTE7CiAgICB9ZWxzZXsKICAgIAlyZXR1cm4gMypmdW5jKG4tMSkrNTsKICAgIH0KfQoKaW50IG1haW4odm9pZCkgewoJaW50IG4gPSAzLCBtOwogICAgbSA9IGZ1bmMobik7CiAgICBwcmludGYoIuaVsOWIl2Fu44Gr44Gk44GE44GmLCBuPSVk44Gu44Go44GN44Gu5YCk44GvJWRcbiIsIG4sIG0pOwoJcmV0dXJuIDA7Cn0K