8 条题解
-
1
#include<iostream> #include<iomanip> using namespace std; int main() { int n,tmp,a1=0,a2=0,a3=0,a4=0; cin>>n; for(int i=0;i<n;i++) { cin>>tmp; if(tmp<=18)a1+=1; else if(19<=tmp&&tmp<=35)a2+=1; else if(36<=tmp&&tmp<=60)a3+=1; else if(tmp>=61)a4+=1; } cout<<fixed<<setprecision(2); cout<<a1*100.0/n<<'%'<<endl; cout<<a2*100.0/n<<'%'<<endl; cout<<a3*100.0/n<<'%'<<endl; cout<<a4*100.0/n<<'%'<<endl; return 0; }
信息
- ID
- 1006
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 5
- 标签
- 递交数
- 486
- 已通过
- 191
- 上传者