Hi i keep getting compile or run time exception, even though my program is working fine in my local, like this below example -
import java.util.ArrayList;
import java.util.Scanner;
public class Fombinatorial {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s=new Scanner(System.in);
int testcases = s.nextInt();
int M=0;
int N=0;
int Q=0;
ArrayList queueList=new ArrayList<Integer>();
if(testcases > 0){
int i=0;
while(testcases > i)
{
M=s.nextInt();
N=s.nextInt();
Q=s.nextInt();
i++;
int f[] = new int[M+1];
if(Q > 0){
for(int j=0;j<Q;j++)
{
queueList.add(s.nextInt());
}
}
for(int k=1;k<=M;k++)
{
//for(int j=k;j>0;j--){
if(k==1)
f[k] = 1;
else
f[k] = f[k-1]* GetPower(k);
//}
}
int div = 1;
for(int k=0;k<queueList.size();k++)
{
div =div*f[(int) queueList.get(k)];
}
int output = (f[M]/div) % N;
System.out.println(output);
System.out.println(output);
}
}
}
private static int GetPower(int k) {
// TODO Auto-generated method stub
int pow=1;
for (int i=0;i<k;i++)
pow = pow*k;
return pow;
}
}
What is wrong with this program???