class Easy286ReverseFactorial
{
public static void main
(String args
[]) { Easy286ReverseFactorial easy = new Easy286ReverseFactorial();
easy.reverseFactorial(3628800);
easy.reverseFactorial(479001600);
easy.reverseFactorial(6);
easy.reverseFactorial(18);
}
public void reverseFactorial(int number) {
int factorial=1 ,count = 1;
while((factorial = (factorial * ++count)) < number );
System.
out.
println(number
+ "=" + (number
==factorial
? "" + count
+ "!" : "NONE")); }
}
Y2xhc3MgRWFzeTI4NlJldmVyc2VGYWN0b3JpYWwKewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZyBhcmdzW10pIHsKICAgICAgICBFYXN5Mjg2UmV2ZXJzZUZhY3RvcmlhbCBlYXN5ID0gbmV3IEVhc3kyODZSZXZlcnNlRmFjdG9yaWFsKCk7CiAgICAgICAgZWFzeS5yZXZlcnNlRmFjdG9yaWFsKDM2Mjg4MDApOwogICAgICAgIGVhc3kucmV2ZXJzZUZhY3RvcmlhbCg0NzkwMDE2MDApOwogICAgICAgIGVhc3kucmV2ZXJzZUZhY3RvcmlhbCg2KTsKICAgICAgICBlYXN5LnJldmVyc2VGYWN0b3JpYWwoMTgpOwogICAgfQoKICAgIHB1YmxpYyB2b2lkIHJldmVyc2VGYWN0b3JpYWwoaW50IG51bWJlcikgewogICAgICAgIGludCBmYWN0b3JpYWw9MSAsY291bnQgPSAxOwogICAgICAgIHdoaWxlKChmYWN0b3JpYWwgPSAoZmFjdG9yaWFsICogKytjb3VudCkpIDwgbnVtYmVyICk7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKG51bWJlciArICI9IiArIChudW1iZXI9PWZhY3RvcmlhbD8gIiIgKyBjb3VudCArICIhIiA6ICJOT05FIikpOwogICAgfQp9