http://acm.hdu.edu.cn/showproblem.php?pid=1865

大数的斐波那契数列,又用java猥琐过了。。。

View Code
import java.io.* ;
import java.math.* ;
import java.util.* ;
import java.text.* ;
public class Main
{
    public static void main(String[]args)
    {
        Scanner cin=new Scanner(new BufferedInputStream(System.in)) ;
        BigInteger[] f=new BigInteger[300] ;
        f[1]=BigInteger.valueOf(1) ;
        f[2]=BigInteger.valueOf(2) ;
        for(int i=3;i<201;i++)
            f[i]=f[i-1].add(f[i-2]) ;
        int t=cin.nextInt() ;
        while(t-->0)
        {
            String str=cin.next() ;
            int len=str.length();
            System.out.println(f[len]) ;
        }
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-08-04
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2021-12-10
  • 2021-12-20
  • 2022-02-10
  • 2022-12-23
相关资源
相似解决方案