Moderator: Board moderators
minskcity wrote:I think this problem's description is WRONG!!!!
The smallest power of 13 that divides 2! does exist - it is 0.
problem description wrote:Given a number n you have to determine the largest power of m, not necessarily prime, that divides n!.
output description wrote:The result is either an integer if m divides n! or a line "Impossible to divide" (without the quotes).
misof wrote:output description wrote:The result is either an integer if m divides n! or a line "Impossible to divide" (without the quotes).
This is the output description. After you have solved the problem, this section tells you how to format your output. In my humble opinion, the case "m doesn't divide n!" is exactly the case when the greatest power of m dividing n! is 0. So, this section tells you: instead of zero, output a message. What's wrong with that?
Dominik Michniewski wrote:My algorithm is:
1. generate primes in range [2...5000]
2. for each M,N pair
- factorize M using prime table from step 1
- factorize N! using prime table from step 1
- output (power of max prime in M in N!)/(power of max prime in M) if it's greater than 0 or appropriate message
Is this wrong ?
removed after AC
Users browsing this forum: No registered users and 1 guest