AcWing 2871. 成绩统计
原题链接
简单
作者:
无之魔
,
2021-04-15 09:41:11
,
所有人可见
,
阅读 209
#include<iostream>
using namespace std;
int main()
{
int n;
int jige=0;
int youxiu=0;
cin>>n;
int t;
for(int i=1;i<=n;i++)
{
cin>>t;
if(t>=85)
{
jige++;
youxiu++;
}
else if(t>=60&&t<85)
{
jige++;
}
}
float jigelv=(float)jige/n;
float youxiulv=(float)youxiu/n;
jigelv=jigelv*100;
youxiulv=youxiulv*100;
int t1,t2;
if(jigelv-(int)jigelv>=0.5)
t1=jigelv+1;
else t1=jigelv;
if(youxiulv-(int)youxiulv>=0.5)
t2=youxiulv+1;
else t2=youxiulv;
cout<<t1<<"%"<<endl<<t2<<"%";
return 0;
}