View Code of Problem 104

#include<stdio.h>
#include<math.h>
int main(){
	int n,v1,v2;
	int t;

	while(scanf("%d%d%d%d",&n,&v1,&v2,&t)!=EOF){
		float t1;
		if(v2>v1){//这种情况永远不可能追上 
			printf("NO\n"); 
		}else{
			t1=1000.00*n/(v1-v2);
			if(t1<=t){
				printf("%.2f\n",t1);
			}else{
				printf("NO\n");
			}
		}
		
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 104