NYOJ 144 某种序列 java

来源:互联网 发布:mysql备份指定数据库 编辑:程序博客网 时间:2024/06/03 16:49

 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=114


水题


import java.math.BigInteger;import java.util.Scanner;public class Main{public static void main(String[] args) {Scanner input=new Scanner(System.in);while(input.hasNext()){BigInteger a=input.nextBigInteger();BigInteger b=input.nextBigInteger();BigInteger c=input.nextBigInteger();BigInteger sum=BigInteger.valueOf(0);for(int i=3;i<=99;i++){sum=c.add(b).add(a);a=b;b=c;c=sum;}System.out.println(sum);}}}


原创粉丝点击