aboutsummaryrefslogtreecommitdiff
path: root/doc/tests/fontes/bits-outputformat.java
blob: 7a3d144cfd5281f0b741b3f03c3e01795361adb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.io.*;
class bits {
  public static void main(String args[]) throws Exception {
    StreamTokenizer st = new StreamTokenizer(System.in);
    int i, j, n, max, inst=0;
    while(42==42) {
      st.nextToken();
      n = (int) st.nval;
      if(n==0) break;
      max=1;
      for(i=0; i<n; i++) {
        st.nextToken();
        j = (int) st.nval;
        if(j>max) max=j;
      }
      for(i=0; max>0; i++)
        max >>= 1;
      inst++;
      System.out.println("Instancia " + inst);
      System.out.println(i*n);
    }
  }
}