记录编号 132579 评测结果 AAAAAAAAAW
题目名称 [NOIP 2012]国王游戏 最终得分 90
用户昵称 Gravatar传奇 是否通过 未通过
代码语言 Pascal 运行时间 0.040 s
提交时间 2014-10-26 10:21:39 内存使用 0.28 MiB
显示代码纯文本
program cojs1263;
var
  a,b,c:array[0..10000] of longint;
  i,j,m,n,k,t:longint;
  max:longint;
procedure gaocheng(x:longint);
var
  i,j,m:longint;
begin
  for i:=1 to a[0] do
    a[i]:=a[i]*x;
  for i:=1 to a[0] do
    if a[i]>9 then
      begin
        a[i+1]:=a[i+1]+a[i] div 10;
        a[i]:=a[i] mod 10;
      end;
  while a[a[0]+1] >0 do
    begin
      inc(a[0]);
      a[a[0]+1]:=a[a[0]] div 10;
      a[a[0]]:=a[a[0]] mod 10;
    end;
end;
procedure gaochu(x:longint);
var
  i,j,k:longint;
begin
  i:=a[0];
  k:=0;
  j:=0;
  while (k<x)and(i>0) do
        begin
          k:=k*10;
          k:=k+a[i];
          dec(i);
        end;
  fillchar(c,sizeof(c),0);
  inc(j);
  b[j]:=k div x;
  k:=k mod x;
  while i>0 do
    begin
      while (k<x)and(i>0) do
        begin
          k:=k*10;
          k:=k+a[i];
          dec(i);
          inc(j);
        end;
      b[j]:=k div x;
      k:=k mod x;
    end;
  b[0]:=j;
end;
begin
  assign(input,'kinggame.in');
  assign(output,'kinggame.out');
  reset(input);
  rewrite(output);

  readln(n);
  fillchar(a,sizeof(a),0);
  max:=0;
  a[0]:=1; a[1]:=1;
  for i:=1 to n+1 do
    begin
      read(k,t);
      gaocheng(k);
      if (k*t>max)and(i<>1) then
        max:=k*t;
    end;
  gaochu(max);
  for i:=1 to b[0] do
    write(b[i]);
  writeln;

  close(input);
  close(output);
end.