Exemple #1
0
 void solve(int caseNum) {
   chars = in.next().toCharArray();
   Node tree = new Node();
   tree.stretch();
   System.out.println(caseNum);
   System.out.print(tree);
 }
Exemple #2
0
 void stretch() {
   if (c == null) return;
   for (Node child : c) {
     if (dim[1 - v] > child.dim[1 - v]) {
       int len = dim[1 - v];
       child.dim[1 - v] = len;
       if (child.c != null) {
         int ea = len / child.c.size();
         for (Node cc : child.c) {
           cc.dim[1 - v] = ea;
           if (len > ea * child.c.size()) {
             cc.dim[1 - v]++;
             len--;
           }
           cc.stretch();
         }
       }
     }
     child.stretch();
   }
 }