Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = [
- '0',
- '3',
- ];
- let print = this.print || console.log;
- let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- //Code
- let smallBottles = +gets();
- let bigBottles = +gets();
- let capacity = +gets();
- let fiveCapacity = parseInt(capacity/5)
- if (((bigBottles>=fiveCapacity&&(capacity-fiveCapacity*5)<=smallBottles)&& bigBottles !==0)){
- print (capacity-fiveCapacity*5)
- } else if ((bigBottles<=fiveCapacity&&(capacity-bigBottles*5)<=smallBottles)&& bigBottles !==0) {
- print (capacity-fiveCapacity*5)
- } else if (bigBottles==0 && smallBottles>=capacity){
- print(capacity)
- } else {
- print(-1)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement