Cod sursa(job #524316)

Utilizator superman13Stefan Maimescu superman13 Data 20 ianuarie 2011 22:31:27
Problema Cifra Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.54 kb
program cifra;
type tab=array[1..30000] of qword;
var n, i, t:integer;
    nr:qword;
    tb:tab;
    c:qword;
{}
function putere(x:qword; n:qword) :qword;
var p:qword;
    i:longint;
begin
  p:=1;
for i:=1 to n do p:=p*x;
putere:=p;
end;
{}
begin
nr:=0;
tb[1]:=0;
assign(input ,'cifra.in');
assign(output ,'cifra.out');
reset(input);
rewrite(output);
read(t);
for i:=1 to t do begin
readln(tb[i]);
for n:=1 to tb[i] do begin
c:=putere(n, n);
nr:=nr+c;
end;
if nr>9 then begin
nr:=nr mod 10;
end;
writeln(nr);
nr:=0;
end;
close(input);
close(output);
end.