You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
649 B
C++
37 lines
649 B
C++
#include <cstdio>
|
|
using namespace std;
|
|
int f(double m)
|
|
{
|
|
if(m>=90&&m<=100)
|
|
return 4;
|
|
if(m>=80&&m<90)
|
|
return 3;
|
|
if(m>=70&&m<80)
|
|
return 2;
|
|
if(m>=60&&m<70)
|
|
return 1;
|
|
if(m>=0&&m<60)
|
|
return 0;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
int n;
|
|
while(~scanf("%d",&n))
|
|
{
|
|
double s,p,sum1=0,sum2=0;
|
|
for(int i=0; i<n; i++)
|
|
{
|
|
scanf("%lf%lf",&s,&p),sum1+=s;
|
|
if(p!=-1)
|
|
sum2+=s*f(p);
|
|
}
|
|
if(sum2==0)
|
|
printf("-1\n");
|
|
else
|
|
printf("%.2lf\n",sum2/sum1);
|
|
|
|
}
|
|
return 0;
|
|
}
|