12578 - 10:6:2

All about problems in Volume 125. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 12578 - 10:6:2

Post by brianfry713 »

Next time post in the existing thread.
Try using double instead of float.
Check input and AC output for thousands of problems on uDebug!
Maciekka
New poster
Posts: 1
Joined: Tue Apr 26, 2016 10:37 pm

Re: 12578 - 10:6:2

Post 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;
}
Post Reply

Return to “Volume 125 (12500-12599)”