天天看点

hdu 2061 treasure the new start freshmen

int main()
{
    int n, count = , k, i, flag;
    double c[], s[], sum1, sum2;
    char name[];
    scanf("%d", &n);
    while (count < n)
    {
        scanf("%d", &k);
        flag = ;
        sum1 = sum2 = ;
        for (i = ; i < k; i++)
        {
            scanf("%s %lf %lf", name, &c[i], &s[i]);
            sum1 += c[i];
            sum2 += c[i] * s[i];
            if (s[i] < )
                flag = ;
        }
        if (flag == )
            printf("Sorry!\n");
        else
            printf("%.2lf\n", sum2 / sum1);
        count++;
        if (count!= n)
            printf("\n");
    }
    return ;
}