Pagini recente » Cod sursa (job #1535657) | Cod sursa (job #11609) | Cod sursa (job #11771) | Cod sursa (job #2973440) | Cod sursa (job #2140913)
Program p;
var s:0..10000000000000000000;
i,n,j,c:integer;
t: array [0..1,1..9] of byte;
e: array [1..30000] of string;
f,g:text;
function trans(s:string):byte;
var t:byte;
begin
t:=ord(s[length(s)])-48;
if length(s)>1 then t:=t+(ord(s[length(s)-1])-48)*10;
trans:=t;
end;
begin
t[0,1]:=1;t[0,2]:=4;t[0,3]:=7;t[0,4]:=6;t[0,5]:=5;t[0,6]:=6;t[0,7]:=3;t[0,8]:=6;t[0,9]:=9;
t[1,1]:=1;t[1,2]:=6;t[1,3]:=3;t[1,4]:=6;t[1,5]:=5;t[1,6]:=6;t[1,7]:=7;t[1,8]:=4;t[1,9]:=9;
assign(f,'cifra.in');
assign(g,'cifra.out');
reset(f);
rewrite(g);
readln(f,n);
for i:=1 to n do
readln(f,e[i]);
for j:=1 to n do begin
c:=trans(e[j]);
s:=0;
for i:=1 to c do begin
s:= s + t[(i div 10) mod 2,i mod 10];
s:= s mod 10;
end;
writeln(g,s);
end;
close(f);
close(g);
end.