杭电ACM2061--Treasure the new start, freshmen!

http://acm.hdu.edu.cn/showproblem.php?pid=2061

 

这题很简单。注意换行。

<span style="font-size:18px;">

#include <stdlib.h>
#include <stdio.h>
int main()
{
    int s,t,i;
    char a[50];
    double x,y;
    double m,n;
    bool f;
    double z;
    scanf("%d",&s);
    while (s--)
    {
        f = true;
        m = 0;n = 0;
        scanf("%d",&t);
        for (i=0;i<t;i++)
        {
            scanf("%s%lf%lf",a,&x,&y);
            if (y<60)
                f = false;
            m = m+x;
            n = n+y*x;
        }
        z = n/m;
        if (f)
            printf("%.2lf\n",z);
        else
            printf("Sorry!\n");
        if (s) 
            printf("\n");
    }
    return 0; 
}
</span>

 


 

posted @ 2015-02-04 15:19  小小暮雨  阅读(257)  评论(0编辑  收藏  举报