[BOJ 7112] Cutting Out of Factorials

View as PDF

Submit solution

Points: 4
Time limit: 1.0s
Memory limit: 128M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

A factorial of a positive integer n (which is noted as n!) is multiplication of all integers from 1 till n: n!=1×2×3×...×n. What is the least number of factorials to be cut out of multiplication of the first k factorials 1!×2!×3!×...×k! so that the multiplication of remaining factorials will be the square of a some integer ?

입력 형식

From the keyboard the value of k (2 ≤ k ≤ 500) is input.

출력 형식

You must output in the increasing order the values of the numbers whose factorials have to be be cut out. If there are several solutions, you must output just one of them.

예제 입력 1

4

예제 출력 1

2

예제 입력 2

6

예제 출력 2

2 3

Comments

There are no comments at the moment.