Biggest of Five

Hi,
I have a TLE problem with problem Biggest of Five on Java. Can anybody help me to improve my solution? Here is my code: [https://pastebin.com/3PZtQs7z](http://Biggest of Five)

Hello,

Your solution is fine, I’ve increased the time limit for java submissions as they traditionally require > 0.2 sec. Feel free to try your solution again.

Cheers,
Edward.

1 Like

Hello, Edward,
Yes, now is OK. Because I’ve tried too many versions of my code and always was passed with TLE. But now is OK. Thank you!

BS,
Atila

Здравейте,
Получавам резултат 7/14. Къде бъркам? Ето го и кода:

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    double first = Double.parseDouble(input.nextLine());
    double second = Double.parseDouble(input.nextLine());
    double third = Double.parseDouble(input.nextLine());
    double fourth = Double.parseDouble(input.nextLine());
    double fifth = Double.parseDouble(input.nextLine());

    double maxvalue = -200000000;
    if (first > maxvalue) {
        maxvalue = first;
    }
    if (second > maxvalue) {
        maxvalue = second;
    }
    if (third > maxvalue) {
        maxvalue = third;
    }

    if (fourth > maxvalue) {
        maxvalue = fourth;
    }
    if (fifth > maxvalue) {
        maxvalue = fifth;
    }
    System.out.printf("%.0f", maxvalue);


}

}

Здравей
тук:

1.5 го принтираш като 2, 1.4 като 1 и тн :slight_smile:

Здравей,

Пробема е че трябва да сложиш една проверка за принтирането.

Тук може да погледнеш модификацията, която ти е необходима:
https://pastebin.com/sGfH7FWy

2 Likes

Благодаря, Денски и Стоян :slight_smile: