Cod sursa(job #299055)
| Utilizator | Data | 6 aprilie 2009 16:03:05 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.68 kb |
Program cifra;
Procedure cit_fis;
var t,f: text;
n,i,j,b,a,q,suma,aux: longint;
begin
assign(t,'cifra.in'); reset(t);
readln(t,n);
assign(f,'cifra.out'); rewrite(f);
for i:=1 to n do
begin
readln(t,b);
suma:=0;
for q:=1 to b do
begin
aux:=q mod 10;
a:=aux;
for j:=2 to q do
begin
aux:=aux*a;
aux:=aux mod 10;
end;
suma:=suma+aux;
suma:=suma mod 10;
end;
writeln(f,suma);
end;
close(t);
close(f);
end;
begin
cit_fis;
end.