记录编号 149725 评测结果 AAAAAAAAAA
题目名称 [NOIP 2008]ISBN号码 最终得分 100
用户昵称 GravatarVacaTionGOD 是否通过 通过
代码语言 Pascal 运行时间 0.000 s
提交时间 2015-02-25 22:28:19 内存使用 0.17 MiB
显示代码纯文本
program p1009;
var
 i,k:longint;
 a:array[1..10] of char;
 b:array[1..10] of integer;
 c:char;
begin
assign(input,'isbn.in');
assign(output,'isbn.out');
reset(input);
rewrite(output);
 k:=0;
 read(a[1]);
 read(c);
 for i:=2 to 4 do read(a[i]);
 read(c);
 for i:=5 to 9 do read(a[i]);
 read(c);
 read(a[10]);
  for i:=1 to 9 do
   begin
    b[i]:=ord(a[i])-48;
    k:=k+b[i]*i;
   end;
  if (k mod 11=ord(a[10])-48)and(a[10]<>'X')
                             or
     (k mod 11=ord(a[10])-78)and(a[10]='X')
     then writeln('Right')
    else
  begin
   b[10]:=k mod 11;
   if b[10]=10 then
   begin
    write(b[1]);
    write(c);
    for i:=2 to 4 do write(b[i]);
    write(c);
    for i:=5 to 9 do write(b[i]);
    write(c);
    write('X');
   end else
    begin
     write(b[1]);
     write(c);
     for i:=2 to 4 do write(b[i]);
     write(c);
     for i:=5 to 9 do write(b[i]);
     write(c);
     write(b[10]);
    end;
   end;
close(input);
close(output);
end.