View Code of Problem 104

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner=new Scanner(System.in);
		while(scanner.hasNext()) {
			int n=scanner.nextInt();
			int v1=scanner.nextInt();
			int v2=scanner.nextInt();
			int t=scanner.nextInt();
			if(v1<=v2) {
				System.out.println("NO");
			}
			else {
				double time=n*1000*1.0/(v1-v2);
				if(time<=t) {
					System.out.printf("%.2f\n",time);
				}
				else {
					System.out.println("NO");
				}
			}
		}
	}

}

Double click to view unformatted code.


Back to problem 104