import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNextInt()) { float n = scanner.nextInt()*1000; float v1 = scanner.nextInt(); float v2 = scanner.nextInt(); float t = scanner.nextInt(); if (v1 - v2 <= 0) { System.out.println("NO"); }else{ float time = n/(v1-v2); if(time<=t) { System.out.println(String.format("%.2f", time)); }else { System.out.println("NO"); } } } } } |
Double click to view unformatted code.