0
点赞
收藏
分享

微信扫一扫

java 处理大数据

就是耍帅 2022-11-17 阅读 197


import java.math.*;
import java.util.*;

public class Main{
public static void main(String args[])
{
BigInteger a[]=new BigInteger [1002] ;
a[1]=new BigInteger("1");
a[2]=new BigInteger("2");
a[3]=new BigInteger("4");
a[4]=new BigInteger("7");
a[5]=new BigInteger("12");
for(int i=6;i<1002;i++)
a[i]=a[i-1].add(a[i-2]).add(a[i-4]);
Scanner in=new Scanner(System.in);
int n;
while(in.hasNext())
{
n=in.nextInt();
System.out.println(a[n]);
}
}

}


举报

相关推荐

0 条评论