ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1233. Amusing Numbers

Show all messages Hide all messages

Good problem! (-) Dmitry 'Diman_YES' Kovalioff 28 Feb 2003 10:49
Re: Good problem! (-) Dinh Hong Minh 28 Feb 2003 11:01

 I agree with you !
Can you post the task description. I am david. Tabo. 28 Feb 2003 13:19
>
>  I agree with you !
>
http://neerc.ifmo.ru/Regional/problems/amusing.htm (-) Dmitry 'Diman_YES' Kovalioff 28 Feb 2003 16:53
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.
Check your mail :) (-) Dmitry 'Diman_YES' Kovalioff 28 Feb 2003 16:50