Page 2 of 2

Re: 12578 - 10:6:2

Posted: Thu Oct 30, 2014 9:14 pm
by brianfry713
Next time post in the existing thread.
Try using double instead of float.

Re: 12578 - 10:6:2

Posted: Wed Apr 27, 2016 12:02 am
by Maciekka
Hi
Why i get WA?

Code: Select all

#include <stdio.h>
#include <math.h>

void zaokr2(double *liczba)
{
    *liczba*=100;
    *liczba=round(*liczba);
    *liczba/=100.0;
}

int main(void)
{
    int T,L;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d",&L);
        double x=acos(-1)*L*L/25.0;
        /*zaokr2(&x);*/
        x*=100;
        x=round(x);
        x/=100.0;
        printf("%.2lf %.2lf\n",x,L*L*0.6-x);
    }
    return 0;
}