GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Послано
WuLF 11 фев 2006 15:59
GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
[code deleted]
this right?
Edited by moderator 22.02.2006 00:38
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
var a,b,n,k1,k2:longint;
begin
readln(a,b,n);
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!!!!!!!!!
Послано
WuLF 11 фев 2006 16:09
8 5 10
Answer: 0 2
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Do you check if N=0??
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
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!!!!!!!!!
Послано
WuLF 11 фев 2006 16:14
My answer is 0 0.
Re: GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!!
Послано
Alexey 11 фев 2006 16:33
Whay it does not work too? (WA#2)
var
a, b, n: LongInt;
x,y,xo,yo,q,w: LongInt;
begin
Read(a, b, n);
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!!!!!!!!!
Послано
l@Zy 11 фев 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!!!!!!!!!
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