#include <stdio.h>
//a{n} = 2a{n-1} + 3, a{0}=-2(再帰あり版)
int rec(int n){
if(n == 0){
return -2;
}
else{
return 2*rec(n-1)+3;
}
}
int main(void) {
int n = 4;
printf("数列anの%d番目の値は%d\n", n
, rec
(n
)); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Ci8vYXtufSA9IDJhe24tMX0gKyAzLCBhezB9PS0yKOWGjeW4sOOBguOCiueJiCkKaW50IHJlYyhpbnQgbil7CglpZihuID09IDApewoJCXJldHVybiAtMjsKCX0KCWVsc2V7CgkJcmV0dXJuIDIqcmVjKG4tMSkrMzsKCX0KCgp9CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgbiA9IDQ7CiAgICBwcmludGYoIuaVsOWIl2Fu44GuJWTnlarnm67jga7lgKTjga8lZFxuIiwgbiwgcmVjKG4pKTsKCXJldHVybiAwOwp9Cgo=