Page 1 of 1

11824 - A Minimum Land Price

Posted: Thu Aug 28, 2014 12:02 am
by axelblaze
it's a simple code but still I'm getting wrong ans. pls help..! :cry:
here's my code...

Code: Select all

Got AC

Re: 11824 - A Minimum Land Price

Posted: Sun Aug 31, 2014 5:37 pm
by lighted
Input

Code: Select all

1
9999999
1000000
0
Acc Output

Code: Select all

Too expensive
Your Output

Code: Select all

-2147483648
Value of ans can overflow int type. So add condition

Code: Select all

for(j=i-1, e=1; j>0  &&  ans<=5000000; j--,e++)
Also j must run until 0, not 1.
Input

Code: Select all

1
7
2
10
0
Acc Output

Code: Select all

136
Your Output

Code: Select all

134

Re: 11824 - A Minimum Land Price

Posted: Wed Sep 03, 2014 9:06 pm
by axelblaze
I got Ac.. Thanks... :D