Advertisement
Spocoman

Mountain Run

Sep 8th, 2024
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double record = Double.parseDouble(scanner.nextLine()),
  7.                 meters = Double.parseDouble(scanner.nextLine()),
  8.                 secondPerMeter = Double.parseDouble(scanner.nextLine()),
  9.                 score = meters * secondPerMeter + (int) (meters / 50) * 30;
  10.  
  11.         if (score < record) {
  12.             System.out.printf("Yes! The new record is %.2f seconds.\n", score);
  13.         } else {
  14.             System.out.printf("No! He was %.2f seconds slower.\n", score - record);
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement