ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1083. Factorials!!!

Why "Wrong Answer"
Posted by Tanjila Hossain 17 Jun 2022 18:45
what is wrong with my program? I used Python
code below:

n = input()
list = n.split()
n = int(list[0])
k = len(list[1])

if (n < k):
    p = k
else:
    p = n

i=2
num = n - k
if (n>=1 and n<=10) and (k>=1 and k<=20) and (num > 0):
    if((n%k) == 0):
        while(num>k):
            p = p*num
            num = n-i*k
            i=i+1

        p = p*k
    else:
        while(num>(n%k)):
            p = p*num
            num = n-i*k
            i=i+1
        p = p*(n%k)

print(p)

Edited by author 17.06.2022 20:39
Re: Why "Wrong Answer"
Posted by isteyakmahmud@gmail.com 29 May 2024 14:49
Don't confuse it, (n mod k) or k are not the final factors!!
skip these lines p = p*k and p = p*(n%k)