Small factorials | CodeChef

No bro…
BufferedReader does the same work(a little bit faster) as Scanner
You could take space seperated integers as -

SCANNER

  1. read a full line

String s = sc.nextLine();

  1. Convert it to String array, by String.split() method

String[] inps = s.split(" ");
/* " " is for whitespace, use any other symbol as present in input */

  1. Now to convert a String to int pass it through Integer.parseInt()

int n=Integer.parseInt( inps[0] ); //this will convert the first string

BUFFERED READER

  1. Change the first step to

String s = br.readLine();

rest all things same