You are not logged in. Please login at www.codechef.com to post your questions!

×

Submit python solution

Hi, I am quite new to codechef and also submitted my first problem. I am extremely sorry if this is not the right question to post. I am having an issue regarding submission. The issue is when I submit the solution against the custom input which is derived from problem description, it works!! (The program able to produce the right result). But then when I submit the solution not against the custom input, I get 'NZEC'. Below is my attached code. If there is a problem with the code, please help me out. I couldn't move one step further. The solution is for the problem https://www.codechef.com/problems/HMAPPY2

def gcd(a,b):
   if a == b: return a
   if a > b: return gcd(a-b,a)
   return gcd(a,b-a)

def lcm(a,b):
   return a*b // gcd(a,b)

testcases = int(input())
for t in range(testcases):
    N,a,b,k = map(int,input().split())
    x = N//a
    y = N//b
    z = N//lcm(a,b)
    print('Win' if x+y-2*z >= k else 'Lose')

asked 15 Feb, 13:38

s1782662's gravatar image

0★s1782662
11
accept rate: 0%

edited 15 Feb, 13:39


Maybe the problem is with your gcd function: https://www.codechef.com/viewsolution/23092269

link

answered 15 Feb, 21:14

ayush4's gravatar image

3★ayush4
163
accept rate: 10%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×280

question asked: 15 Feb, 13:38

question was seen: 84 times

last updated: 15 Feb, 21:14