返回题解分享
讨论 / 题解分享/ 帖子详情

成绩分析(编程题) - 题解

#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 喜欢 0 阅读
回复 (0)
默认 最新
暂无回复,快来抢沙发!