Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MountainRun {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double seconds = Double.parseDouble(scanner.nextLine());
- double meters = Double.parseDouble(scanner.nextLine());
- double timeInSecondsForOneMeter = Double.parseDouble(scanner.nextLine());
- double inclide = meters * timeInSecondsForOneMeter;
- double inclide2 = Math.floor(meters / 50) * 30;
- double timeNeeded = inclide + inclide2;
- double ostatuk = timeNeeded - seconds;
- if (seconds > timeNeeded){
- System.out.printf("Yes! The new record is %.2f seconds.",timeNeeded);
- }else{
- System.out.printf("No! He was %.2f seconds slower.",ostatuk );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement