⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ac1233.pas

📁 uralcode
💻 PAS
字号:
program ural1233;
var
  pow:array[0..19]of qword;
  a,b,d:qword;
  l,e:byte;
procedure fail;
  begin
    writeln(0);
    halt;
  end;
procedure judgefail(a,b:qword);
  var
    p:byte;
  begin
    p:=1;
    while a mod 10=0 do begin
      a:=a div 10;
      inc(p);
    end;
    if a=1 then if b<>p then fail;
  end;
begin
  pow[0]:=1;for e:=1 to 19 do pow[e]:=pow[e-1]*10;

  read(a,b);
  judgefail(a,b);
  l:=1;while a>=pow[l] do inc(l);
  e:=0;
  repeat
    inc(e);
    if e<=l then
      d:=a div pow[l-e]-pow[e-1]+1
    else
      d:=a*pow[e-l]-pow[e-1];
    if (e<l) and (d>=b) or (e=l) and (d>b) then fail;
    if d>b then d:=b;
    dec(b,d);
  until b=0;
  writeln(pow[e-1]-1+d);
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -