Cod sursa(job #137176)

Utilizator Vlad-andreiVlad Fisca Vlad-andrei Data 17 februarie 2008 09:30:05
Problema Cifra Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.57 kb
program cifre;
uses crt;
var n,s,p,i,t,j:word;
begin
     clrscr;
     write('t=');
     read(t);
     s:=0;
     p:=1;
     for i:=1 to t do
     begin
         read(n);
         for j:=1 to n do
     begin
          case (j mod 4) of
               0: p:= (j mod 10)*(j mod 10)*(j mod 10)*(j mod 10);
               1: p:= (j mod 10);
               2: p:= (j mod 10)*(j mod 10);
               3: p:= (j mod 10)*(j mod 10)*(j mod 10);
          end;
     end;
     s:=(s+p) mod 10;
     end;
     for j:=1 to n do
     writeln(s);
     readkey;
end.