题解
【入门】平均绩点
1 条题解
-
0
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ string a; cin>>a; int s=0; bool f=1; for(int i=0;i<a.size();i++){ if(a[i]=='A'){ s+=4; }else if(a[i]=='B'){ s+=3; }else if(a[i]=='C'){ s+=2; }else if(a[i]=='D'){ s+=1; }else if(a[i]!='F'){ f=0; break; } } if(f)cout<<fixed<<setprecision(2)<<s*1.0/a.size()<<endl; else cout<<"Unknown"<<endl; } return 0; }
- 1