程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> hdu 2399 GPA

hdu 2399 GPA

編輯:C++入門知識

hdu 2399 GPA


題意:

 

 

 

#include
#include
#include
using namespace std;

int main(){
    string str;
    while(getline(cin,str)){
        int num = 0;
        double sum = 0;
        for(int i=0;i

 

 

 

 

GPA

平均績點

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3137 Accepted Submission(s): 1867 Problem Description Each course grade is one of the following five letters: A, B, C, D, and F. (Note that there is no grade E.) 每一門課程的成績用分別用A,B,C,D,F表示。(注意這裡沒有E) The grade A indicates superior achievement , whereas F stands for failure. A表示成績優秀,F表示不及格。 In order to calculate the GPA, the letter grades A, B, C, D, and F are assigned the following grade points, respectively: 4, 3, 2, 1, and 0. 為了計算GPA,A,B,C,D,F分別代表4,3,2,1,0個學分。 Input The input file will contain data for one or more test cases, one test case per line. 輸入文件將包含多組測試事件,每一個事件一行。 On each line there will be one or more upper case letters, separated by blank spaces. 在每一行將會有一個或多個大寫字母,每兩個字母之間用空格表示。 Output Each line of input will result in exactly one line of output. 對於每一行輸入,恰好用一行輸出。 If all upper case letters on a particular line of input came from the set {A, B, C, D, F} 所有的輸入字母都是大寫, then the output will consist of the GPA, displayed with a precision of two decimal places. 然後輸出GPA,結果精確到兩位小數。 Otherwise, the message "Unknown letter grade in input" will be printed. 否則,輸出提示信息“ Unknown letter grade in input ”; Sample Input
A B C D F
B F F C C A
D C E F

Sample Output
2.00
1.83
Unknown letter grade in input

Author 2006Rocky Mountain Warmup
Source HDU “Valentines Day” Open Programming Contest 2009-02-14

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved