#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+Ci8vYXtufSA9IDJhe24tMX0gKyAzLCBhezB9PS0yKOWGjeW4sOOBguOCiueJiCkKaW50IHJlYyhpbnQgbil7CglpZihuPT0wKXsKCQlyZXR1cm4gLTI7Cgl9CgllbHNlewoJCXJldHVybiAyKnJlYyhuLTEpKzM7Cgl9CgoKfQoKaW50IG1haW4odm9pZCkgewogICAgaW50IG4gPSA0OwogICAgcHJpbnRmKCLmlbDliJdhbuOBriVk55Wq55uu44Gu5YCk44GvJWRcbiIsIG4sIHJlYyhuKSk7CglyZXR1cm4gMDsKfQoK