Off white cow month season 21 E

Here Insert Picture Description
Here Insert Picture Description
AC Code

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    double zongs=0,zongx=0;
    for(int i=0;i<n;i++)
    {
        int lei;
        double fen,p,pb,m,mb,e,eb;
        cin>>lei>>fen>>p>>pb>>m>>mb>>e>>eb;
        if(lei==2)continue;
        a[i]=round(p*pb+m*mb+e*eb);
        zongs=zongs+a[i]*fen;
        zongx=zongx+fen;
    }
    double ans;
    ans=zongs/zongx;
    printf("%.2f",ans);
   return 0;
}

Published 17 original articles · won praise 0 · Views 185

Guess you like

Origin blog.csdn.net/weixin_45719073/article/details/104039042
Recommended