public static void main(String[] args)
{
int
[]a=new int[1000002];
a[0]=1;
a[1]=1;
a[2]=2;
a[3]=2;
for(int
i=2;i<=500000;i++){
a[2*i]=(a[i]+a[2*i-2])%1000000000;
a[2*i+1]=a[2*i];
}
Scanner in = new
Scanner(System.in);
int
n=in.nextInt();
System.out.println(a[n]);
}
原文:http://www.cnblogs.com/qiwu/p/3675274.html