Pabon_SEC

!! Really Strange !!

Feb 17th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.65 KB | None | 0 0
  1. import java.math.BigInteger;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String[]args){
  7.        
  8.         BigInteger n,a,b;
  9.        
  10.         Scanner sc = new Scanner(System.in);
  11.        
  12.         while(sc.hasNext()){
  13.            
  14.             n = sc.nextBigInteger();
  15.            
  16.             if(n.equals(BigInteger.ZERO)){
  17.                 System.out.println("1");
  18.                 continue;
  19.             }
  20.             a = n.subtract(BigInteger.ONE);
  21.            
  22.             b = BigInteger.ONE;
  23.            
  24.             b = b.add(b);
  25.            
  26.             System.out.println((n.multiply(a)).add(b));
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment