记录编号 123489 评测结果 AAAAAAAAAAAAAAA
题目名称 [USACO 1.2] 命名那个数字 最终得分 100
用户昵称 Gravatarhjt 是否通过 通过
代码语言 Pascal 运行时间 0.024 s
提交时间 2014-09-27 00:08:03 内存使用 1.38 MiB
显示代码纯文本
program name;
var  s:array[1..5000]of string;
     n:string;
     a:array['A'..'Z']of longint;
     i,p,k:longint;
     f,ff:boolean;

begin
  assign(input,'namenum.in');
  assign(output,'namenum.out');
  reset(input);
  rewrite(output);
  ff:=false;
  for i:=1 to 4617 do
    readln(s[i]);
  read(n);
  a['A']:=2;
  a['B']:=2;
  a['C']:=2;
  a['D']:=3;
  a['E']:=3;
  a['F']:=3;
  a['G']:=4;
  a['H']:=4;
  a['I']:=4;
  a['J']:=5;
  a['K']:=5;
  a['L']:=5;
  a['M']:=6;
  a['N']:=6;
  a['O']:=6;
  a['P']:=7;
  a['Q']:=0;
  a['R']:=7;
  a['S']:=7;
  a['T']:=8;
  a['U']:=8;
  a['V']:=8;
  a['W']:=9;
  a['X']:=9;
  a['Y']:=9;
  a['Z']:=0;
  for i:=1 to 4617 do
    begin
      f:=false;
      p:=0;
      if length(s[i])<>length(n) then continue;
      for k:=1 to length(s[i]) do
        begin
          inc(p);
          if a[s[i][k]]<>ord(n[p])-ord('0') then begin f:=true;break;end;
        end;
      if not(f) then begin writeln(s[i]);ff:=true;end;
    end;
  if not(ff) then writeln('NONE');
  close(input);
  close(output);
end.