Cod sursa(job #188306)

Utilizator netedu_andreiFII Andrei Netedu netedu_andrei Data 7 mai 2008 20:30:39
Problema Cifra Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.63 kb
var n:string[200];
    f,g:text;
    ok:boolean;
    a,b:array[1..1000]of longint;
    e,c,i,lg,l:longint;
    x,r,y,m,q:integer;
begin
assign(f,'cifra.in');reset(f);
assign(g,'cifra.out');rewrite(g);
ok:=false;     
readln(f,x);
for i:=1 to x do
begin
if ok=false then begin
for l:=2 to 99 do
begin
c:=l mod 10;
e:=l mod 4;
if e=0 then e:=4;
m:=1;
for y:=1 to e do
m:=m*c;
a[l]:=m mod 10;
b[l]:=(b[l-1]+a[l])mod 10;
Ok:=true;
end;
end;
readln(f,n);
m:=0;
lg:=length(n);
q:=ord(n[lg])-ord('0');
a[1]:=1;
b[1]:=1;
if lg>1 then m:=ord(n[lg-1])-ord('0');
r:=m*10+q;
writeln(g,a[r]);
end;
close(f);
close(g);
end.