Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function main() {
  2.     var t = parseInt(readLine());
  3.     for(var a0 = 0; a0 < t; a0++){
  4.         var n = parseInt(readLine()); // hier überschreibst du immer den gleichen wert
  5.     }
  6.    
  7.     // wenn du die Werte in einen Array schreiben willst, musst du sowas machen
  8.     var tests = [];
  9.     for(var i = 0; i < t; i++){
  10.         tests.push(parseInt(readLine()));
  11.     }
  12.  
  13.     var cycles = t.split('\n'); // ich weiß nicht genau, was du hier machen wills, aber t ist eine Zahle
  14.  
  15.     var numberOfCycles = cycles[0]; // numberOfCycles steht in t
  16.  
  17.     cycles.shift();
  18.     var heigthArr = [];
  19.  
  20.     for (i=0; i<numberOfCycles; i++){
  21.         var currheight = 1;
  22.         for(m =cycles[i]; m>=0; m--){
  23.         if(m!=0){
  24.             if(m %2 == 0){
  25.                 currheight = currheight*2;
  26.             } else {
  27.                 currheight = currheight +1;
  28.             }  
  29.         }
  30.             heigthArr.push(currheight);
  31.         }
  32.     }
  33.    
  34.     for(u=0; u<heigthArr.length -1; u++ ){
  35.         console.log(heigthArr[u] + '\n');
  36.     }
  37.    
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement