aboutsummaryrefslogtreecommitdiff
path: root/doc/tests/fontes/bits-runtime.pas
blob: ed496c077ebf9bbfe708a6cb031465967038f04c (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, inst, max, n: Longint;
    v: array[0..1] of Longint;
begin
  while true do
  begin
    read(n);
    if n=0 then break;
    max := 1;
    for i:=0 to n-1 do
    begin
      read(v[i]);
      if v[i]>max then max:=v[i]
    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*n);
    writeln()
  end
end.