Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MineralWater2 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int small = Integer.parseInt(scanner.nextLine());
- int big = Integer.parseInt(scanner.nextLine());
- int capacity = Integer.parseInt(scanner.nextLine());
- int loadedBig = capacity/5;
- if(loadedBig>big){
- loadedBig=big;
- }
- int neededSmall = capacity-5*loadedBig;
- if(neededSmall > small){
- System.out.println("-1");
- }else{
- System.out.println(neededSmall);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement