ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1457. Heating Main

how to explain it???
Posted by Ilya_Malinovsky 28 Aug 2010 17:14
I got WA #4 with such code:

#include <cstdio>
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int n;
    double a, sum = 0.0;

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%le", &a);
        sum += a;
    }

    printf("%.15e", sum / n);

    return 0;
}

WA #5 with such code:

#include <cstdio>
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int n;
    double a, sum = 0.0;

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%le", &a);
        sum += a;
    }

    printf("%.7e", sum / n);

    return 0;
}

WA #6 with such code:

#include <cstdio>
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int n;
    double a, sum = 0.0;

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%le", &a);
        sum += a;
    }

    printf("%.8e", sum / n);

    return 0;
}

AC with such code:

#include <cstdio>
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int n;
    double a, sum = 0.0;

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%le", &a);
        sum += a;
    }

    printf("%.15e", sum / n);

    return 0;
}

But, connecting to the problem statements, "The offset should be printed with at least six digits after decimal point."