标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 29530 Accepted Submission(s):
13853
import java.util.*;
class Main{
public static void main(String args[])
{Scanner cin=new Scanner(System.in);
while(cin.hasNext())
{int n=cin.nextInt();
System.out.println(sum(n));
}
}
public static long sum(int s)
{long []a=new long [41];
a[1]=3;a[2]=8;
for(int i=3;i<41;i++)
a[i]=2*(a[i-1]+a[i-2]);
return a[s];
}
}
这个题目是假如最后那个是O的话,前一个就只能是e或f,那就是2乘以a[i-2];如果最后一个是e或f的话那就是2乘以a[i-1];
标签:
原文地址:http://www.cnblogs.com/1314wamm/p/5364639.html