标签:style blog http color io os ar for div
签到题,输入两个表,注意细心点就行了。
1 #include<cstdio> 2 #include<cstring> 3 const int M=16; 4 char s[M],cp[M][M]={"A","A-","B+","B","B-","C+","C","C-","D","D-","F"}; 5 double si[]={4,3.7,3.3,3,2.7,2.3,2,1.7,1.3,1.0,0}; 6 int main(){ 7 int n; 8 while(~scanf("%d",&n)){ 9 double ss=0; 10 int sc=0,c; 11 while(n--){ 12 scanf("%d%s",&c,s); 13 for(int i=0;i<11;i++){ 14 if(!strcmp(cp[i],s)){ 15 ss+=si[i]*c; 16 sc+=c; 17 break; 18 } 19 } 20 } 21 if(!sc){ 22 puts("0.00"); 23 continue; 24 } 25 printf("%.2f\n",ss/sc); 26 } 27 return 0; 28 }
end
标签:style blog http color io os ar for div
原文地址:http://www.cnblogs.com/gaolzzxin/p/3989240.html