HOJ 3057 Cai's DOTA game

http://acm.hit.edu.cn/hoj/problem/view?id=3057

#include

int main()
{
    int t, level, levelt[4], levele[5];
    int i, avgt, avge, s1, s2, w, l;

    scanf("%d", &t);

    while (t--) {
        scanf("%d", &level);

        for (i = 0; i < 4; i++)
            scanf("%d", &levelt[i]);
        for (i = 0; i < 5; i++)
            scanf("%d", &levele[i]);

        avgt = (level + levelt[0] + levelt[1] + levelt[2] + levelt[3]) / 5;
        avge = (levele[0] + levele[1] + levele[2] + levele[3] + levele[4]) / 5;


        s1 = 100 + (avge -avgt) * 10;
        if (s1 > 200)
            s1 = 200;
        if (s1 < 20)
            s1 = 20;
        w = s1 + (avgt - level) * 10;
        if (w > 200)
            w = 200;
        if (w < 1)
            w = 1;


        s2 = 100 - (avge - avgt) * 10;
        if (s2 > 200)
            s2 = 200;
        if (s2 < 20)
            s2 = 20;
        l = s2 + (level - avgt) * 10;
        if (l > 200)
            l = 200;
        if (l < 1)
            l = 1;

        printf("%d %d\n", w, l);
    }

    return 0;
}

你可能感兴趣的:(HOJ)