#include <stdio.h>
//a{n+1} = -2a{n} + 4, a{0}=2(再帰なし版)
int main(void) {
int n = 4;
int an=2;
for(int i=0;i<n;i++){
an=-2*an+4;
} printf("数列a%dの値は%d\n", n
, an
);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Ci8vYXtuKzF9ID0gLTJhe259ICsgNCwgYXswfT0yKOWGjeW4sOOBquOBl+eJiCkKaW50IG1haW4odm9pZCkgewogICAgaW50IG4gPSA0OwppbnQgYW49MjsKZm9yKGludCBpPTA7aTxuO2krKyl7CmFuPS0yKmFuKzQ7CiB9ICAgcHJpbnRmKCLmlbDliJdhJWTjga7lgKTjga8lZFxuIiwgbiwgYW4pOwoKCXJldHVybiAwOwp9Cgo=