aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.2/doc/tests/fontes/bits-runtime.java
blob: f7bffc54a3b1b1b3330740a06b3461fb6102c25e (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
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 + "\n");
      throw new Exception("OPA! Runtime error, hehehe...");
    }
  }
}