hdu 1202
2013-09-21 19:10
375 查看
#include"stdio.h"
int gcd(int a,int b)
{
int t;
for(t=a,a=b,b=t%b;b!=0;t=a,a=b,b=t%b);
return a;
}
int main()
{
int N;
while(scanf("%d",&N)!=EOF)
{
double a,b;
double aa=0,bb=0;
double ret=1.0;
for(int i=0;i<N;i++)
{
scanf("%lf%lf",&a,&b);
if(b==-1) continue;
int point=0;
if(b<=100&&b>=90) point=4;
else if(b<90&&b>=80) point=3;
else if(b<80&&b>=70) point=2;
else if(b<70&&b>=60) point=1;
else point=0;
aa+=a;bb+=a*point;
}
if(aa==0) printf("-1\n");
else
{
ret=(double)bb/aa;
printf("%.2lf\n",ret);
}
}
return 0;
}
int gcd(int a,int b)
{
int t;
for(t=a,a=b,b=t%b;b!=0;t=a,a=b,b=t%b);
return a;
}
int main()
{
int N;
while(scanf("%d",&N)!=EOF)
{
double a,b;
double aa=0,bb=0;
double ret=1.0;
for(int i=0;i<N;i++)
{
scanf("%lf%lf",&a,&b);
if(b==-1) continue;
int point=0;
if(b<=100&&b>=90) point=4;
else if(b<90&&b>=80) point=3;
else if(b<80&&b>=70) point=2;
else if(b<70&&b>=60) point=1;
else point=0;
aa+=a;bb+=a*point;
}
if(aa==0) printf("-1\n");
else
{
ret=(double)bb/aa;
printf("%.2lf\n",ret);
}
}
return 0;
}
相关文章推荐
- HDU 1202 The calculation of GPA(数学)
- HDU 1202 The cacluation of GPA
- 51nod 1202 子序列个数 (子序列套路dp)&& HDU 5791 Two (两串求相同子序列)
- hdu 1202 18岁生日
- HDU-1202-The calculation of GPA(恶心水题)
- hdu 1202(水题,大坑)
- HDU 1202 The calculation of GPA
- HDU 1202 The calculation of GPA
- hdu 1202
- hdu1202 java版本The calculation of GPA
- HDU 1202 The calculation of GPA
- HDU1202
- hdu 1202 The calculation of GPA
- HDU_ACM_1202
- hdu1202
- HDU1202 The calculation of GPA
- hdu 1202 The calculation of GPA
- hdu 1202
- HDU 1202 The calculation of GPA
- HDU1202 The calculation of GPA【水题】