#include <stdio.h>
int func(int n){
int i,a[30];
a[1]=1;
a[2]=2;
for(i=3;i<=n;i++){
a[i]=-2*a[i-1]+2*a[n-2];
}
return a[n];
}
int main(void) {
// your code goes here
int n=3;
printf("数列anについて、n=%dの時%d",n
,func
(n
)); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CmludCBmdW5jKGludCBuKXsKCWludCBpLGFbMzBdOwoJYVsxXT0xOwoJYVsyXT0yOwoJZm9yKGk9MztpPD1uO2krKyl7CgkJYVtpXT0tMiphW2ktMV0rMiphW24tMl07Cgl9CglyZXR1cm4gYVtuXTsKfQppbnQgbWFpbih2b2lkKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCglpbnQgbj0zOwoJcHJpbnRmKCLmlbDliJdhbuOBq+OBpOOBhOOBpuOAgW49JWTjga7mmYIlZCIsbixmdW5jKG4pKTsKCXJldHVybiAwOwp9Cg==