Hey I've tried all the cases.. x^0 is 1..0^0=1...0^x=0..But still getting WA
I've removed all spaces to limit code to 700B
import java.io.*;
public class Main{
public static void main(String args[])throws IOException
{BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
int testCount = Integer.parseInt(br.readLine());
while(testCount>0){
testCount--;
String arr[]=br.readLine().split(" ");
int a=arr[0].charAt(arr[0].length()-1)-48;
int b=arr[1].charAt(arr[1].length()-1)-48;
if(arr[1].length()!=1) b+=(10*(arr[1].charAt(arr[1].length()-2)-48));
if(a==0 && b==0){System.out.println(1);continue;}
if(b==0){System.out.println(1);continue;}
if(a==0){System.out.println(0);continue;}
b%=4;
if(b==0)b=4;
System.out.println((int)Math.pow(a,b)%10);
}
}}