Pagini recente » Cod sursa (job #516606) | Cod sursa (job #138373) | Cod sursa (job #1327397) | Cod sursa (job #817622) | Cod sursa (job #1147297)
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 n:string;
nr,err:byte;
t,i:integer;
begin
assign(input, 'cifra.in'); reset(input);
assign(output,'cifra.out'); rewrite(output);
readln(t);
for i:=1 to t do begin
readln(n);
if length(n)>2 then delete(n,1,length(n)-2);
val(n,nr,err);
writeln((4*(nr div 20)+r[nr mod 20])mod 10);
end;
close(input); close(output);
end.