Cod sursa(job #2333036)

Utilizator natys.esanuIeseanu natys.esanu Data 31 ianuarie 2019 17:19:05
Problema Cifra Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.93 kb
program cifra;

var
  f, g: text;
  s:string;
  nr,s1,n,t,i: longint;

begin
  assign(f, 'cifra.in');
  reset(f);
  assign(g, 'cifra.out');
  rewrite(g);
  readln(f,t);
  for i:=1 to 1 do
  begin
  readln(f,s);
  n:=length(s);
  if n=1 then s1:=ord(s[1])-48
  else begin
  s1:=ord(s[n-1])-48;
  s1:=10*s1+(ord(s[n])-48);
  end;
  nr:=4*(s1 div 20);
  s1:=s1 mod 20;
  if s1>=1 then nr:=nr+1;
  if s1>=2 then nr:=nr+4;
  if s1>=3 then nr:=nr+7;
  if s1>=4 then nr:=nr+6;
  if s1>=5 then nr:=nr+5;
  if s1>=6 then nr:=nr+6;
  if s1>=7 then nr:=nr+3;
  if s1>=8 then nr:=nr+6;
  if s1>=9 then nr:=nr+9;
  if s1>=11 then nr:=nr+1;
  if s1>=12 then nr:=nr+6;
  if s1>=13 then nr:=nr+3;
  if s1>=14 then nr:=nr+6;
  if s1>=15 then nr:=nr+5;
  if s1>=16 then nr:=nr+6;
  if s1>=17 then nr:=nr+7;
  if s1>=18 then nr:=nr+4;
  if s1>=19 then nr:=nr+9;
 writeln(g,nr mod 10);
 
  end;
  close(f);
  close(g);
end.