|
|
back to boardDiscussion of Problem 1607. Taxiwa#4 Posted by koyot 25 May 2008 20:39 here's my text: program Project2; var a,b,c,d:longint; begin readln (a,b,c,d); while c>a do begin a:=a+b; c:=c-d; end; if c=a+b then writeln (c) else writeln (a);
end. what's the problem??? help me please Re: wa#4 4 3 6 1 correct answer: 6 Re: wa#4 Posted by koyot 26 May 2008 14:16 thanks but now wa is #6 can't understand what ellse I've missed. Re: wa#4 give me your code Re: wa#4 Posted by koyot 26 May 2008 17:07 program Project2; var a,b,c,d:longint; begin readln (a,b,c,d); if c<a+b then writeln (c) else begin while c>a do begin a:=a+b; c:=c-d; end; writeln (a); end;
end. Re: wa#4 Posted by rohit 26 May 2008 18:05 If a>c in the beginning then answer is a not c. Also check whether a>c after adding b each time. Re: wa#4 correct answer is 7. Re: wa#4 4 3 6 1 correct answer is 7 Re: wa#4 WHY??? Petr offers 4 Taxi says 6 Petr won't increase because 4+3>6 => the answer is 7 Re: wa#4 Here is correct code var a,b,c,d:integer; begin Readln(a,b,c,d); While a<=c do begin a:=a+b; if a>c then a:=c; c:=c-d; end; Write(a); end. Edited by author 09.11.2009 14:56 Re: wa#4 correct answer is 6! Read the task carefully!! Re: wa#4 No correct answer must be 6. Because, Peter offer: 4 but when you add 3 it will be 7>6 in this case a must be equal 6. Beacause driver satisfy 6 money. In this case put this condition to your iterator: if(a>c) a=c; |
|
|