I got about 5WA on it. i check all test that was on contests-tests.rar but again it says WA:(
Here is my code
mail me aidin_n7@hotmail.com
Const
B : Array[0..20] of double =
((1),(10),(100),(1000),(10000),(100000),
(1000000),(10000000),(100000000),
(1000000000),
(10000000000.0),
(100000000000.0),
(1000000000000.0),
(10000000000000.0),
(100000000000000.0),
(1000000000000000.0),
(10000000000000000.0),
(100000000000000000.0),
(1000000000000000000.0),
(10000000000000000000.0),
(100000000000000000000.0));
Var
M,K : Longint;
P,Y : comp;
I,L : byte;
Flag : Boolean;
Begin
Readln(k,m);
L:=0;
repeat Inc(L);
Until B[L]>K;
P:=0;
Y:=K-B[L-1];
For i:=1 to L do
P:=P+(trunc(Y) div Trunc(B[L-I]))+1;
If M<p then
Writeln(0)
Else
If M=P then
Writeln(K)
Else
Begin
IF Y<B[L-1] then
begin
Dec(L);
flag:=False;
end
else
flag:=True;
If Y=0 Then
Begin
Writeln(0);
Exit
End;
Repeat
M:=M-Trunc(P);
Y:=Y*10; Inc(L);
P:=y;
Until M<=p;
Writeln(B[L-ord(Flag)]+M-1:0:0);
End;
End.