Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String year = scanner.nextLine();
- double p = Double.parseDouble(scanner.nextLine()),
- h = Double.parseDouble(scanner.nextLine()),
- game = ((48 - h) * 3 / 4) + h + p * 2 / 3;
- if (year.equals("leap")) {
- game *= 1.15;
- }
- System.out.println((int) game);
- }
- }
- ИЛИ:
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String year = scanner.nextLine();
- double p = Double.parseDouble(scanner.nextLine()),
- h = Double.parseDouble(scanner.nextLine()),
- game = (((48 - h) * 3 / 4) + h + p * 2 / 3)
- * (year.equals("leap") ? 1.15 : 1);
- System.out.println((int) game);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement