Advertisement
divanov94

Untitled

Mar 26th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function renovation(input) {
  2.     let h=Number(input.shift());
  3.     let w=Number(input.shift());
  4.     let percentNonPaint=Number(input.shift());
  5.     let walls=h*w*4;
  6.     walls=Math.ceil(walls-(walls/100*percentNonPaint));
  7.     let command=input.shift();
  8.     while(command !="Tired!"){
  9.         walls -=parseInt(command);
  10.         if(walls<=0){
  11.             break;
  12.         }
  13.         command=input.shift();
  14.  
  15.     }
  16.     if(walls>0){
  17.         console.log(`${walls} quadratic m left.`)
  18.     }else if(walls==0){
  19.         console.log(`All walls are painted! Great job, Pesho!`);
  20.     }else {
  21.         console.log(`All walls are painted and you have ${Math.abs(walls)} l paint left!`)
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement