#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+S5ZWP6aGMRAppbnQgZnVuYyhpbnQgbil7CglpZihuPT0wKXsKCQlyZXR1cm4gLTE7Cgl9CgllbHNlewoJCXJldHVybiAzKmZ1bmMobi0xKSs1OwoJfQp9CgppbnQgbWFpbih2b2lkKSB7CglpbnQgbiA9IDMsIG07CiAgICBtID0gZnVuYyhuKTsKICAgIHByaW50Zigi5pWw5YiXYW7jgavjgaTjgYTjgaYsIG49JWTjga7jgajjgY3jga7lgKTjga8lZFxuIiwgbiwgbSk7CglyZXR1cm4gMDsKfQo=