Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function renovation(input) {
- let h=Number(input.shift());
- let w=Number(input.shift());
- let percentNonPaint=Number(input.shift());
- let walls=h*w*4;
- walls=Math.ceil(walls-(walls/100*percentNonPaint));
- let command=input.shift();
- while(command !="Tired!"){
- walls -=parseInt(command);
- if(walls<=0){
- break;
- }
- command=input.shift();
- }
- if(walls>0){
- console.log(`${walls} quadratic m left.`)
- }else if(walls==0){
- console.log(`All walls are painted! Great job, Pesho!`);
- }else {
- console.log(`All walls are painted and you have ${Math.abs(walls)} l paint left!`)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement