记录编号 15207 评测结果 AAAAAAAAAA
题目名称 查字典 最终得分 100
用户昵称 Gravatar王瑞祥K 是否通过 通过
代码语言 Pascal 运行时间 1.390 s
提交时间 2009-11-10 16:26:50 内存使用 17.92 MiB
显示代码纯文本
program scanword(input,output);
var
 a,c:array[1..10000] of string;
 p:array[1..10000] of longint;
 b:array[1..26,1..2000] of string;
 e:array[1..26,1..2000] of longint;
 d:array[1..26] of longint;
 i,j,l,m,n:longint;
procedure tp(t:longint);
var k:longint;
begin
 for j:=1 to m do begin
  k:=ord(a[j][1])-96;
  inc(d[k]);
  b[k,d[k]]:=a[j];
  e[k,d[k]]:=p[j];
 end;
end;
begin
 assign(input,'scanword.in');assign(output,'scanword.out');
 reset(input);rewrite(output);
 readln(m);
 for i:=1 to m do begin readln(a[i]); readln(p[i]); end;
 readln(n);
 for i:=1 to n do readln(c[i]);
 tp(m);
 for i:=1 to n do begin
  l:=ord(c[i][1])-96;
  for j:=1 to d[l] do
   if b[l,j]=c[i] then writeln(e[l,j]);
 end;
 close(input);close(output);
end.