Pagini recente » Cod sursa (job #733072) | Istoria paginii utilizator/cosmincelrau11 | Monitorul de evaluare | Cod sursa (job #1704887) | Cod sursa (job #744765)
Cod sursa(job #744765)
program TheVic1;
var int,outo:text; N:string; T,N2,cod,j,i:integer;
function Power(x,y : integer) : longint;
begin
if y=0 then power:=1 else power:=x*power(x,y-1);
end;
begin
assign(int, 'cifra.in');
assign(outo, 'cifra.out');
reset(int);
rewrite(outo);
readln(int, T);
For i:=1 to T do
begin
readln(int,N);
val(N,N2,cod);
cod:=0;
for j:=1 to N2 do cod:=cod+power(j,j);
str(cod,N);
cod:=length(N);
writeln(outo,N[cod]);
end;
close(int);
close(outo);
end.