Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.math.BigInteger;
- import java.util.Scanner;
- public class Main {
- public static void main(String[]args){
- BigInteger n,a,b;
- Scanner sc = new Scanner(System.in);
- while(sc.hasNext()){
- n = sc.nextBigInteger();
- if(n.equals(BigInteger.ZERO)){
- System.out.println("1");
- continue;
- }
- a = n.subtract(BigInteger.ONE);
- b = BigInteger.ONE;
- b = b.add(b);
- System.out.println((n.multiply(a)).add(b));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment