11824 - A Minimum Land Price

All about problems in Volume 118. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
axelblaze
New poster
Posts: 34
Joined: Mon Jun 23, 2014 7:45 pm

11824 - A Minimum Land Price

Post 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
Last edited by axelblaze on Wed Sep 03, 2014 9:05 pm, edited 2 times in total.
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11824 - A Minimum Land Price

Post 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
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
axelblaze
New poster
Posts: 34
Joined: Mon Jun 23, 2014 7:45 pm

Re: 11824 - A Minimum Land Price

Post by axelblaze »

I got Ac.. Thanks... :D
Post Reply

Return to “Volume 118 (11800-11899)”