Pagini recente » Diferente pentru runda/teme_acmunibuc_2014_2 intre reviziile 2 si 3 | Cod sursa (job #175228)
Cod sursa(job #175228)
Program en;
var s: string;
n,m,e: longint;
v,c: array[0..9] of integer;
t,f: text;
begin
v[0]:=0; c[0]:=0;
v[1]:=1; c[1]:=7;
v[2]:=5; c[2]:=4;
v[3]:=2; c[3]:=1;
v[4]:=8; c[4]:=8;
v[5]:=3; c[5]:=5;
v[6]:=9; c[6]:=2;
v[7]:=2; c[7]:=9;
v[8]:=8; c[8]:=6;
v[9]:=7; c[9]:=3;
assign(t,'cifra.in'); reset(t);
assign(f,'cifra.out'); rewrite(f);
readln(t);
while not eof(t) do
begin
readln(t,s);
n:=0;
m:=0;
val(s[length(s)-1],m,e);
if e=0 then
n:=c[m];
val(s[length(s)],m,e);
n:=n+v[m];
writeln(f,n mod 10);
end;
close(t);
close(f);
end.