Pagini recente » Cod sursa (job #2229591) | Cod sursa (job #2269208) | Cod sursa (job #1613260) | Cod sursa (job #1141465) | Cod sursa (job #609588)
Cod sursa(job #609588)
var a:array [0..120] of byte;
i,x,j,t,e,nr:integer;
n,c:string;
f,g:text;
begin
assign(f,'cifra.in');
reset(f);
assign(g,'cifra.out');
rewrite(g);
for i:=1 to 99 do
begin
x:=1;
for j:=1 to i do
begin
x:=x mod 10;
x:=x *i;
end;
a[i]:=(a[i-1]+x) mod 10;
end;
readln(f,t);
for i:=1 to t do
begin
readln(f,n);
c:=copy(n,length(n)-1,2);
val(c,nr,e);
writeln(g,a[nr]);
end;
close(f);
close(g);
end.