题解分享
题解分享简介
成绩分析(编程题) - 题解
题干有点问题
及格成绩:60
优秀成绩:85
```
#include <cstdio>
int main(){
int n, x, mi = 0, mx = 0;
scanf("%d", &n);
int total = n;
while(n--){
scanf("%d", &x);
if(x >= 60) mi++;
if(x >= 85) mx++;
}
printf("%d%%\n", (int)(((float)mi / total) * 100 + 0.5));
printf("%d%%\n", (int)(((float)mx / total) * 100 + 0.5));
return 0;
}
```
查看全文
0
0
0
2
成绩分析(编程题) - 题解
```cpp
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #define LL long long
#define endl '\n'
void solve()
{
int n;
cin >> n;
double pass = 0, good = 0;
for (int i = 1; i <= n; i++)
{
int score;
cin >> score;
if (score >= 85)
{
pass++;
good++;
}
else if (score >= 60)
pass++;
}
printf("%.lf%c\n%.lf%c", pass / n * 100, '%', good / n * 100, '%');
}
signed main()
{
// ios::sync_with_stdio(0);
// cin.tie(0), cout.tie(0);
solve();
return 0;
}
```
查看全文
0
0
0
1



