geting similar problems again and again

https://www.codechef.com/viewsolution/15592681

This is my code for problem:LTM40AB

please see why this is giving wrong answer

Here-

Input1
2
1 1 1 1
1 2 3 4
Your Output
0
4
Judge's Verdict
OK. 2 Integers found '0' and '4'

But see this-

Input 2
2
1 1 1 2
1 2 3 4
Your Output
1
5
Expected Output
1
4
Jury's Verdict
WRONG ANSWER. Expected "1" "4" . Found "1" "5"

You forgot to reset your “count” variable :stuck_out_tongue:

1 Like

Hello,
I suppose you have started coding recently.

The Question is easy and dont panic

What you have to do: Given integers a, b, c, d find the number of integer solutions of inequality x < y, where a ≤ x ≤ b and c ≤ y ≤ d.

How to do: Iterate through all possible values of x and for each one, count the number of valid values of y to pair with it.

P.S. - Remember this also as you have just started… if your code is right and you are having problem with WA then may be its the fault of python3.5, try submitting it in python2.7.

for you reference (same code submitted in python2.7 but not in python3.5) click here

Happy Coding

1 Like
then may be its the fault of python3.5,

What does this mean?

yes I have started recently…I will keep your suggestions in mind…

Thanks…Now, I found where I was wrong

@vijju123 see this : https://ibb.co/gOby0b

same(exactly same code) only input and output pattern is different

one(2.7) is giving AC and other(3.5) is giving WA

see my last 2 submissions, https://www.codechef.com/status/STFM,goyal_banna

thanks

//