1.題目說明
小藍給學生們組織了一場考試,卷面總分為100?分,每個學生的得分都是一個?0?到?100 的整數。
如果得分至少是?60 分,則稱為及格。
如果得分至少為?85 分,則稱為優秀。
請計算及格率和優秀率,用百分數表示,百分號前的部分四舍五入保留整數。
2.輸入格式
輸入的第一行包含一個整數?n,表示考試人數。
接下來?n?行,每行包含一個?0?至?100 的整數,表示一個學生的得分。
3.輸出格式
輸出兩行,每行一個百分數,分別表示及格率和優秀率。
百分號前的部分四舍五入保留整數。
4.數據范圍
對于?50% 的評測用例,1≤n≤100。
對于所有評測用例,1≤n≤10000。
5.輸入樣例
7
80
92
56
74
88
100
0
6.輸出樣例
71%
43%
7.代碼
#include<iostream>
using namespace std;
const int N = 10010;
int n;
double pass,super;
int main(){scanf("%d",&n);for(int i = 0;i<n;i++){int score;scanf("%d",&score);if(score >=60) pass++;if(score >= 85) super++;}double res1 = pass/n*100,res2 = super/n*100;printf("%.0lf%%\n%.0lf%%",res1,res2);return 0;
}