// PascalABC.NET 3.1, сборка 1204 от 24.03.2016 const n=100; // заменить на 10000 var a:array[1..n] of byte; i:byte; j:integer; begin // инициализация, для for j:=1 to n do a[j]:=Random(256); // собственно программа for i:=0 to 255 do for j:=1 to n do if a[j]=i then Write(i,' '); end.
const
n=100; // заменить на 10000
var
a:array[1..n] of byte;
i:byte;
j:integer;
begin
// инициализация, для
for j:=1 to n do a[j]:=Random(256);
// собственно программа
for i:=0 to 255 do
for j:=1 to n do
if a[j]=i then Write(i,' ');
end.
Тестовое решение:
5 8 9 11 11 14 14 17 18 19 21 22 24 24 29 30 33 36 40 45 46 47 55 55 56 58 61 62 64 66 68 73 74 75 85 88 91 94 96 96 96 98 102 103 108 109 111 111 116 119 122 123 129 129 130 135 137 139 143 144 149 149 155 155 160 169 170 173 177 178 181 182 190 193 196 198 199 199 200 206 206 207 209 222 224 225 226 229 230 235 237 240 243 246 249 250 251 252 254 255
[0, 0, "a", 1]
[1, 1, "b", 2]
[1, 2, "bb", 3]
[2, 2, "b", 4]
[1, 3, "bbb", 5]
[2, 3, "bb", 6]
[3, 3, "b", 7]
[1, 4, "", 8]
[2, 4, "bbb", 9]
[3, 4, "bb", 10]
[4, 4, "b", 11]
[1, 5, "", 12]
[2, 5, "", 13]
[3, 5, "bbb", 14]
[4, 5, "bb", 15]
[5, 5, "b", 16]
[0, 6, "aa", 17]
[6, 6, "a", 18]
[6, 7, "aa", 19]
[7, 7, "a", 20]
[6, 8, "aaa", 21]
[7, 8, "aa", 22]
[8, 8, "a", 23]
[5, 9, "baaab", 24]
[9, 9, "b", 25]
#Ruby22
s = "aaaab"
n = 0
for r in 0...s.size
for l in 0..r
t = s[l..r]
if t.reverse == t
n += 1
p [l,r,t,n]
end
end
end