fork download
  1. class Factorio {
  2. public static void main(String[] args) {
  3. System.out.println(factorio(3628800));
  4. System.out.println(factorio(479001600));
  5. System.out.println(factorio(6));
  6. System.out.println(factorio(18));
  7. }
  8.  
  9. private static String factorio(int i) {
  10. int result = i;
  11. int divisor = 2;
  12. while(result > 1) {
  13. result /= divisor;
  14. divisor++;
  15. }
  16. if(result==1) return (divisor-1)+"!"; else return "NONE";
  17. }
  18. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
10!
12!
3!
NONE