My code getting TLE in sgu 112 problem. I am new to java programming so I am not understanding why my code is getting TLE. I also have submitted 3 code from github for this problem. They also got TLE. Now what should I do? Question link : http://mirror.codeforces.com/problemsets/acmsguru/problem/99999/112
My code :
//In the name of ALLAH
//package OverRiding;
import java.math.BigInteger;
import java.util.Scanner;
public class Example1 {
public static void main(String[]args) {
Scanner cin = new Scanner( System.in );
BigInteger bigA = cin.nextBigInteger();
BigInteger bigB = cin.nextBigInteger();
BigInteger aPowb, bPowa;
aPowb = bigA.pow ( bigB.intValue() );
bPowa = bigB.pow ( bigA.intValue() );
BigInteger ans = aPowb.subtract ( bPowa );
System.out.println(ans);
}
}