Pagini recente » Cod sursa (job #3180462) | Cod sursa (job #1077789) | Cod sursa (job #2168838) | Cod sursa (job #94022) | Cod sursa (job #326125)
Cod sursa(job #326125)
var t,te:text;
teste,i:integer;
x:array[0..9] of byte;
a,b,c:char;
ok:boolean;
begin
assign(t,'cifra.in'); reset(t);
assign(te,'cifra.out'); rewrite(te);
readln(t,teste);
x[0]:=0;
x[1]:=1;
x[2]:=5;
x[3]:=4;
x[4]:=0;
x[5]:=5;
x[6]:=1;
x[7]:=0;
x[8]:=4;
x[9]:=5;
for i:=1 to teste do
begin
ok:=false;
while (not(eoln(t))) do begin read(t,a); if eoln(t) then begin ok:=true; break; end; read(t,b); end;
if ok then
begin
c:=a;
a:=b;
b:=c;
end;
writeln(te,(((ord(a)-48) mod 2)*5+x[ord(b)-48]) mod 10);
readln(t);
end;
close(te);
end.