Pagini recente » Cod sursa (job #914007) | Cod sursa (job #1005830) | Cod sursa (job #1437342) | Cod sursa (job #497586) | Cod sursa (job #141026)
Cod sursa(job #141026)
const r:array[0..19] of byte=(
0,1,5,2,8,3,9,2,8,7,7,8,4,7,3,8,4,1,5,4
);
var s:string;
nr,err:byte;
i,t:integer;
begin
assign(input,'cifra.in'); reset(input);
assign(output,'cifra.out'); rewrite(output);
readln(t);
for i:=1 to t do begin
readln(s);
if length(s)>2 then delete(s,1,length(s)-2);
val(s,nr,err);
writeln((4*(nr div 20)+r[nr mod 20])mod 10);
end;
close(input); close(output);
end.