描述 Description | ||||||||||||||||||||||||
身份证的验证码是这样算的:
|
10分钟ac,两次提交,第一次忘定义变量l了。。学校服务器fp居然不能编译,害我把测评机当编译器用...
program b1032;
const
w:array[2..18]of integer=(2,4,8,5,10,9,7,3,6,1,2,4,8,5,10,9,7);
ky:array[0..10]of char=('1','0','X','9','8','7','6','5','4','3','2');
var
a:array[1..18]of integer;
i,k,y,l:longint;
s:string;
begin
k:=0;
readln(s);
for i := 2 to 18 do
begin
a[i]:=ord(s[19-i])-48;
k:=a[i]*w[i]+k;
end;
l:=k mod 11;
write(ky[l]);
end.