Cod sursa(job #363477)

Utilizator dcupsaoCupsa Darius dcupsao Data 13 noiembrie 2009 15:26:00
Problema Loto Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 1.44 kb
program loto;
var bagate,solutie:array[0..100]of longint;
    i,x,y,n,castig:longint;
    f:text;
    b,ok:boolean;
begin
 assign(f,'loto.in'); reset(f);
 readln(f,n);
 for i:=1 to n do read(f,bagate[i]);
 readln(f);
 for i:=1 to 6 do read(f,solutie[i]);
 close(f);

 assign(f,'loto.out'); rewrite(f);
 x:=0;
 y:=3;
 while y<=n do begin
        inc(x);
        inc(y);
        ok:=false;
        for i:=x to y do
                if solutie[i-x+1]<>bagate[i] then ok:=true;
        if ok=false then castig:=4;
        ok:=false;
        for i:=x to y do
                if solutie[i-x+2]<>bagate[i] then ok:=true;
        if ok=false then castig:=4;
        ok:=false;
        for i:=x to y do
                if solutie[i-x+3]<>bagate[i] then ok:=true;
        if ok=false then castig:=4;
 end;
 x:=0;
 y:=4;
 while y<=n do begin
        inc(x);
        inc(y);
        ok:=false;
        for i:=x to y do
                if solutie[i-x+1]<>bagate[i] then ok:=true;
        if ok=false then castig:=5;
        ok:=false;
        for i:=x to y do
                if solutie[i-x+2]<>bagate[i] then ok:=true;
        if ok=false then castig:=5;
 end;
 x:=0;
 y:=5;
 while y<=n do begin
        inc(x);
        inc(y);
        ok:=false;
        for i:=x to y do
                if solutie[i-x+1]<>bagate[i] then ok:=true;
        if ok=false then castig:=6;
 end;
 writeln(f,'castig cu ',castig,' numere');
 close(f);
end.