ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1430. Crime and Punishment

GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Posted by WuLF 11 Feb 2006 15:59
GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Posted by linuX must DIE 11 Feb 2006 16:01
[code deleted]

this right?

Edited by moderator 22.02.2006 00:38
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Posted by linuX must DIE 11 Feb 2006 16:03
var a,b,n,k1,k2:longint;
begin
while n>=a  do
begin
n:=n-a;
k1:=k1+1;
end;
while n>=b do
begin
n:=n-b;
k2:=k2+1;
end;
writeln(k1,' ',k2);
end.
земляк помоги решить 10 задачу или проверь
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Posted by WuLF 11 Feb 2006 16:09
8 5 10
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Posted by Paskall 11 Feb 2006 16:13
Do you check if N=0??
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Posted by Paskall 11 Feb 2006 16:13
Do you check if N=0??
sorry for doublepost

Edited by author 11.02.2006 16:13
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Posted by WuLF 11 Feb 2006 16:14
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Posted by Alexey 11 Feb 2006 16:33
Whay it does not work too? (WA#2)

var
a, b, n: LongInt;
x,y,xo,yo,q,w: LongInt;

begin

x := n div a;
xo := n mod a;
y := n div b;
yo := n mod b;
q := x * a + xo div b * b;
w := y * b + yo div a * a;

If q >= w then
WriteLn(x, ' ', xo div b)
Else
WriteLn(yo div a, ' ', y);
end.
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Posted by l@Zy 11 Feb 2006 17:01
47 3 49
ans: 0 16
2 3 7
ans:
2 1
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Posted by Vsevolod 6 Mar 2024 16:53
It is not guaranteed that A >= B and 2 test checks this. AFAIK if you will throw error if B > A, then you will get Runtime Error on test 2.

Edited by author 06.03.2024 16:54