#import <Foundation/Foundation.h>
int fn(int n){
if(n==0){
return 1;
}else if(n==1){
return 4;
}else{
return 2*fn(n-1)+fn(n-2);
}
}
int main(int argc, const char * argv[]) {
//计算数列:f(0)=1,f(1)=4,f(n+2)=2*f(n+1)+f(n),n是大于0的整数,求f(10)
@autoreleasepool {
NSLog(@"fn(10)=%i",fn(10));
}
return 0;
}