Program penezokazi; type word=0..64000; var data:array[0..4049] of byte; source:file of longint; f:array[1..3] of file of word; x:array[1..3] of word; {počet čísel v jednotlivých souborech} a,b:word; pom:longint; begin for a:=0 to 4049 do data[a]:=0; assign(source,'sss.sss'); assign(f[1],'cesta_2'); assign(f[2],'cesta_3'); assign(f[3],'cesta_4'); reset(source); while not eof(source) do begin read(source,pom); {čtení vstupu} if(pom>=1)and(pom<=32400) then begin {test na 1. interval} dec(pom); if (data[pom shr 3] and (1 shl (pom and 15)))=0 then {test a nastavení bitů v poli} data[pom shr 3]:=data[pom shr 3] or (1 shl (pom and 15)) else writeln('nasla se falesna bankovka',pom); end else if (pom>=32401)and(pom<=64800)then begin {1. soubor - vzheledem k velikosti intervalu} inc(x[1]); {už nemusím ukládat longinty} if x[1]=1 then rewrite(f[1]); {1.číslo intervalu založí soubor} a:=pom-32401; write(f[1],a); end else if (pom>=64801)and(pom<=97200) then begin {2. interval se ukládá do 2. souboru} inc(x[2]); if x[2]=1 then rewrite(f[2]); a:=pom-64801; write(f[2],a); end else if (pom>=97201)and(pom<=99999) then begin {3. malý interval do 3. souboru} inc(x[3]); if x[3]=1 then rewrite(f[3]); a:=pom-97201; write(f[3],a); end else write (' v souboru je falesna bankovka mimo rozsah serie'); end; close(source); for a:=1 to 3 do {načítám jednotlivé soubory } if x[a]>0 then begin {existuje soubor ? } if x[a]>32400 then { velikost intervalu je 32400, je-li čísel více, pak je jistě nějaká falešná! } write ('bankovek je prilis hodne->v souboru je falesna bankovka'); reset(f[a]); for pom:=0 to 4049 do data[pom]:=0; while not eof(f[a]) do begin read(f[a],b); if (data[b shr 3] and (1 shl (b and 15)))=0 then data[b shr 3]:=data[b shr 3] or (1 shl (b and 15)) else writeln('nasla se falesna bankovka'); end; close(f[a]); end; end.