Sunday, 28 December 2014

UVA 11715 - Car(c file)

Problem Type : Simple Math

#include <stdio.h>
#include <math.h>
int main()
{
    int test_case, count=0;
    double u, v, a, s, t;
    while(scanf("%d", &test_case)==1)
    {
        if(test_case==0) break;
        count++;
        switch(test_case)
        {
            case 1:
                    scanf(" %lf %lf %lf", &u, &v, &t);
                    a=(v-u)/t;
                    s=((v+u)/2)*t;
                    printf("Case %d: %.3lf %.3lf\n", count, s, a);
                    break;
            case 2:
                    scanf(" %lf %lf %lf\n", &u, &v, &a);
                    t=((v-u)/a);
                    s=((v+u)/2)*t;
                    printf("Case %d: %.3lf %.3lf\n", count, s, t);
                    break;
            case 3:
                    scanf(" %lf %lf %lf", &u, &a, &s);
                    v=sqrt((u*u)+2*a*s);
                    t=((v-u)/a);
                    printf("Case %d: %.3lf %.3lf\n", count, v, t);
                    break;
            case 4:
                    scanf(" %lf %lf %lf", &v, &a, &s);
                    u=sqrt((v*v)-2*a*s);
                    t=((v-u)/a);
                    printf("Case %d: %.3lf %.3lf\n", count, u, t);
                    break;
        }
    }
}

No comments:

Post a Comment

ট্রিগার এর মাধ্যমে ডাটা ইনসার্ট - insert data using Database Trigger (Mysql)

সর্বপ্রথম আমরা প্রবলেমটা বুঝিঃ আমি একটা টেবিলের একটা কলামের ভ্যালুর উপর ডিপেন্ড করে আরেকটা কলামে ডাটা insert করব । এই কাজটা ট্রি...