16 цветов кодируются 4 битами (2^4=16), т. е. при 256 Кб (килобит) может быть адресовано 256/16=16 К 16-цветных пикселей. Количество пикселей в экране будет В*Г (В - вертикальное разрешение, Г-горизонтальное) . При указанном соотношении 1,33 (4:3) будет верным равенство В*Г=(4/3)*В^2. Тогда В=Кв. Корень [(3/4)*16384/C] (16К=16384, С-количество страниц) . При С=1 выходит В=110.85... Ясное дело, вертикальное разрешение должно быть целым, т. е. это будет 110 или 111. Поскольку Г=В*4/3=147.8...,и горизонтальное разрешение тоже должно быть целым, выходит 147 или 148. Т. е. возможны разрешения 147*111 (всего 16317 пикселей из 16384 возможных) либо 148*110 (16280 пикселей) При С=2 выйдет В=78.38...,Г=104.51...,т. е. возможно разрешение 105*78 (всего 8190 пикселей из 8192 возможных) . Для разрешения 104*79 не хватит памяти, поскольку 8216>8192. При С=4 выйдет В=55.42...,Г=73.9...,т. е. возможны разрешения 74*55 (всего 4070 пикселей из 4096 возможных) или 73*56 (4088 из 4096).
//Ночной отвратный код //PascalABC.NET 3.2 сборка 1318
Var f,g:text; mins,i,currents,minsCount:integer; minsWords:array of string; buf1,buf2:char; wordFlag:boolean; s:string; begin mins:=integer.MaxValue; assign(f,'input.txt'); reset(f); read(f,buf1); if not(EOF(f)) then read(f,buf2); if ((buf1=' ') or (buf1=chr(10)) or (buf1=chr(13))) and ((buf2=' ') or (buf2=chr(10)) or (buf2=chr(13))) then wordFlag:=false; if (buf1<>' ') and ((buf2=' ') or (buf2=chr(10)) or (buf2=chr(13))) then begin s:=buf1; wordFlag:=false; end; if (buf1<>' ') and (buf2<>' ') then begin s:=buf1+buf2; currents:=0; for i:=1 to length(s) do if (lowcase(s[i])='a') or (lowcase(s[i])='e') or (lowcase(s[i])='i') or (lowcase(s[i])='o') or (lowcase(s[i])='u') then inc(currents); wordflag:=true; end; while not(EOF(f)) do begin if ((buf1=' ') or (buf1=chr(10)) or (buf1=chr(13))) and (buf2<>' ') then begin wordFlag:=true; currents:=0; s:=buf2; end else if ((buf1<>' ') and (buf2=' ')) or ((buf2=chr(10)) or (buf2=chr(13))) then begin wordFlag:=false; for i:=1 to length(s) do if (lowcase(s[i])='a') or (lowcase(s[i])='e') or (lowcase(s[i])='i') or (lowcase(s[i])='o') or (lowcase(s[i])='u') then inc(currents); if(currents=mins) then begin inc(minsCount); setlength(minsWords,minsCount); minsWords[minsCount-1]:=s; end; if(currents<mins) and (currents<>0) then begin minsCount:=1; setlength(minsWords,minsCount); minsWords[minsCount-1]:=s; mins:=currents; end; end else if wordFlag then s:=s+buf2; buf1:=buf2; read(f,buf2); end; if wordFlag then begin s+=buf2; for i:=1 to length(s) do if (lowcase(s[i])='a') or (lowcase(s[i])='e') or (lowcase(s[i])='i') or (lowcase(s[i])='o') or (lowcase(s[i])='u') then inc(currents); if(currents=mins) then begin inc(minsCount); setlength(minsWords,minsCount); minsWords[minsCount-1]:=s; end; if(currents<mins) and (currents<>0) then begin minsCount:=1; setlength(minsWords,minsCount); minsWords[minsCount-1]:=s; mins:=currents; end; end else if buf2<>' ' then begin if (lowcase(buf2)='a') or (lowcase(buf2)='e') or (lowcase(buf2)='i') or (lowcase(buf2)='o') or (lowcase(buf2)='u') then currents:=1; if(currents=mins) then begin inc(minsCount); setlength(minsWords,minsCount); minsWords[minsCount-1]:=buf2; end; if currents<mins then begin minsCount:=1; setlength(minsWords,minsCount); minsWords[minsCount-1]:=buf2; mins:=currents; end; end; close(f); assign(g,'output.txt'); rewrite(g); for i:=0 to length(minsWords)-1 do write(g,minsWords[i],' '); close(g); end.
Пример содержимого input.txt: Lorem ipsum dolor sit amet consectetur adipiscing elit etc Curabitur posuere erat et felis ultricies pulvinar u Пример содержимого output.txt: sit etc et u
1.
program test;
var i,k2,k3,k4,k5:integer;
a:array [1..20] of integer;
begin
k2:=0;
k3:=0;
k4:=0;
k5:=0;
for i:=1 to 20 do
begin
a[i]:=random(4)+2;
if a[i]=2 then k2:=k2+1;
if a[i]=3 then k3:=k3+1;
if a[i]=4 then k4:=k4+1;
if a[i]=5 then k5:=k5+1;
write(a[i],' ')
end;
writeln;
writeln(k2);
writeln(k3);
writeln(k4);
write(k5)
end.
2.
var i,j,v:integer;
a:array [1..10] of integer;
begin
for i:=1 to 10 do
begin
a[i]:=random (100);
write(a[i]:3)
end;
for i:=1 to 9 do
for j:=1 to 9 do
if a[j]>a[j+1] then
begin
v:=a[j];
a[j]:=a[j+1];
a[j+1]:=v
end;
writeln;
for i:=1 to 10 do write(a[i]:3)
end.
3.
var a:array [1..10] of integer;
i,j,m,v:integer;
begin
randomize;
for i:=1 to 10 do
begin
a[i]:=random(100);
write(a[i]:3)
end;
writeln;
for i:=1 to 10 do
begin
m:=i;
for j:=i to 10 do
if a[m] mod 10 < a[j] mod 10 then m:=j;
v := a[i];
a[i]:= a[m];
a[m] := v;
write(a[i]:3)
end;
end.