链接: https://pan.baidu.com/s/1X4b5AUxRpzajz6eAhkGgfQ
提取码: sh82
AC
#include <iostream>
#include <cstdio>
using namespace std;
double ans,S,H,p,T,V,n,l;
int main()
{
cin>>T;
while(T--)
{
cin>>n;
ans=0;
for(int i=1;i<=n;i++)
{
cin>>l>>p;
if(p<1.0)
ans+=p*l*l*l;
else
ans+=l*l*l;
}
cin>>S>>H>>V;
ans+=V;
if(ans/S<=H)
printf("%.2f
",ans/S);
else
printf("%.2f
",H);
}
}
wa
#include <iostream>
#include <cstdio>
using namespace std;
double ans,S,H,p[1005],T,V,n,l[1005];
int main()
{
cin>>T;
while(T--)
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>l[i]>>p[i];
}
cin>>S>>H>>V;
ans=V;
for(int i=1;i<=n;i++)
{
if(p[i]<1.0)
ans+=p[i]*l[i]*l[i]*l[i];
else
ans+=l[i]*l[i]*l[i];
}
if(ans/S<=H)
printf("%.2f
",ans/S);
else
printf("%.2f
",H);
}
}