Cod sursa(job #28261)

Utilizator NebhotepMetes Alexandru Nebhotep Data 7 martie 2007 17:30:21
Problema Cifra Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.63 kb
var i,a,j,n,p,m,t:longint;
    f,g:text;
begin
assign(f,'cifra.in');reset(f);
assign(g,'cifra.out');rewrite(g);
readln(f,t);
for i:=1 to t do begin
    readln(f,n);
    for j:=1 to n do begin
        a:=i;
        m:=a mod 10;
        p:=a mod 10;
        if m=0 then n:=n+0;
        if m=1 then n:=n+1;
        if m=5 then n:=n+5;
        if m=6 then n:=n+6;
        if m=2 then begin
           if p mod 4=1 then n:=n+2;
           if p mod 4=2 then n:=n+4;
           if p mod 4=3 then n:=n+8;
           if p mod 4=0 then n:=n+6;
        end;
        n:=n mod 10;
    end;
    writeln(g,n);
end;
close(g);
end.