View Code of Problem 104

#include <stdio.h>

int main(void)
{
    int n,v1,v2,totalt;
    double needt;
    while(scanf("%d%d%d%d",&n,&v1,&v2,&totalt) != EOF)
    {
        if(v2 >= v1)
            printf("NO\n");
        else
        {
            if((v1 - v2) * totalt >= n * 1000)
            {
                needt = 1.0 * n * 1000 / (v1 - v2);
                printf("%.2lf\n",needt);
            }
            else
                printf("NO\n");
        }
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 104