aboutsummaryrefslogtreecommitdiff
path: root/doc/tests/fontes/bits-incorrect.pas
blob: 7dbcd4bd2d32c1330cb4a9c5052dffd621f2e509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
program bits;
var i, j, n, max, inst: Longint;
begin
  inst:=0;
  while true do
  begin
    read(n);
    if n=0 then break;
    max:=1;
    for i:=0 to n-1 do
    begin
      read(j);
      if j>max then max:=j
    end;
    i:=0;
    while max>0 do
    begin
      max := max div 2;
      i := i + 1
    end;
    write('Instancia ');
    inst := inst + 1;
    writeln(inst);
    writeln(i);
    writeln()
  end
end.