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);
- double worldRecord = Double.parseDouble(scanner.nextLine());
- double distance = Double.parseDouble(scanner.nextLine());
- double timeForOneM = Double.parseDouble(scanner.nextLine());
- double addingTimes = Math.floor(distance / 15);
- double resistance = addingTimes * 12.5;
- double totalTimeIvan = (distance * timeForOneM) + resistance;
- if (worldRecord <= totalTimeIvan) {
- System.out.printf("No, he failed! He was %.2f seconds slower.", totalTimeIvan - worldRecord);
- } else {
- System.out.printf("Yes, he succeeded! The new world record is %.2f seconds.", totalTimeIvan);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement