Whats wrong with my code to HARRY AND MAGICAL NUMBER?!
It even passed the sample case and some manual inputs which I tested it with so why am I getting WA.
Problem: CodeChef: Practical coding for everyone
Check my code (C):
int array, minimum, size, c,s;
for ( c = 0 ; c < size ; c++ )
minimum = array;
for ( c = 1 ; c < size ; c++ )
if ( array[c] < minimum )
minimum = array[c];
Your code fails on the test case
in the above given test value of K (as stated in question) is 3.
in your code u are only checking for the if the minimum number is K or not. Try changing your code dude…
Try this input:
1 12 18
You could try my solution…
I didn’t try it whether it is correct or not, because i didn’t find link to this question in practice problems.
I used Binary Search to solve this problem.and here is my solution.
Please try to submit it and tell me also whether it is right or wrong.
My solution is correct. I submitted it and got AC.
my code also output -1 if i input
1 12 18
but got AC
Don’t Know about your Testcase :3 :3