简单选择
学分绩点
http://www.nowcoder.com/questionTerminal/a0c09a7e0da04e728810a8aca7226b7b
#include <stdio.h> int main(){ int n,i,sum; float GPA; while(scanf("%d",&n)!=EOF){ float a[n],b[n]; GPA=0; sum=0; for(i=0;i<n;i++) scanf("%f ",&a[i]); for(i=0;i<n;i++) scanf("%f ",&b[i]); for(i=0;i<n;i++) sum+=a[i]; for(i=0;i<n;i++) { if(b[i]>=90) b[i]=4.0; else if(b[i]>=85) b[i]=3.7; else if(b[i]>=82) b[i]=3.3; else if(b[i]>=78) b[i]=3.0; else if(b[i]>=75) b[i]=2.7; else if(b[i]>=72) b[i]=2.3; else if(b[i]>=68) b[i]=2.0; else if(b[i]>=64) b[i]=1.5; else if(b[i]>=60) b[i]=1.0; else b[i]=0; } for(i=0;i<n;i++) GPA+=a[i]*b[i]; GPA/=sum; printf("%.2f\n",GPA); } }(•̀ᴗ•́)و