标签:pre lse nbsp clu int ++ bsp 计算 can
#include <stdio.h> int main() { int n,t,i; float sum,s,p,m,k; while(~scanf("%d",&n)) { sum=0.0; m=0.0; for(i=1;i<=n;i++) { scanf("%f %f",&s,&p); if(p>=90) t=4; else if(p>=80) t=3; else if(p>=70) t=2; else if(p>=60) t=1; else t=0; if(p>=0) { m+=s; sum+=s*t; } else if(p==-1) { sum=sum; m=m; } } k=sum/m*1.0; if(m==0) printf("-1\n"); else printf("%.2f\n",k); } return 0; }
标签:pre lse nbsp clu int ++ bsp 计算 can
原文地址:https://www.cnblogs.com/zzjam--1/p/11491486.html