import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { int a,b,c; BigInteger a0,a1,a2; BigInteger temp = new BigInteger("0"); Scanner sc = new Scanner(System.in); while (sc.hasNext()) { a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); a0 = new BigInteger(String.valueOf(a)); a1 = new BigInteger(String.valueOf(b)); a2 = new BigInteger(String.valueOf(c)); int x = 99; while(x!=2){ temp = a0.add(a1).add(a2); a0 = a1; a1 = a2; a2 = temp; x--; } System.out.println(temp); } } } |
Double click to view unformatted code.