ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1233. Amusing Numbers

Dmitry 'Diman_YES' Kovalioff Good problem! (-) [9] // Задача 1233. Amusing Numbers 28 фев 2003 10:49
Dinh Hong Minh Re: Good problem! (-) [2] // Задача 1233. Amusing Numbers 28 фев 2003 11:01

 I agree with you !
I am david. Tabo. Can you post the task description. [1] // Задача 1233. Amusing Numbers 28 фев 2003 13:19
>
>  I agree with you !
>
Dmitry 'Diman_YES' Kovalioff http://neerc.ifmo.ru/Regional/problems/amusing.htm (-) // Задача 1233. Amusing Numbers 28 фев 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.
Dmitry 'Diman_YES' Kovalioff Check your mail :) (-) // Задача 1233. Amusing Numbers 28 фев 2003 16:50