Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function task( arr){
- let maxQuantity= Number(arr[0]);
- let days = Number(arr[1]);
- let costs=0;
- let spirit =0;
- for (let index = 1; index <= days; index++) {
- if (index%11==0){
- maxQuantity+=2;
- }
- if (index%2==0){
- costs+= maxQuantity*2;
- spirit+=5;
- }
- if ( index%3==0){
- costs+= (3+5)*maxQuantity;
- spirit+=13
- }
- if(index%5==0){
- costs+=15*maxQuantity;
- spirit+=17;
- if(index%3==0){
- spirit +=30;
- }
- }
- if (index%10==0){
- spirit-=20;
- costs+= 15+5+3;
- if (days==10){
- spirit-=30;
- }
- }
- }
- console.log(`Total cost: ${costs}`);
- console.log(`Total spirit: ${spirit}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement