一本通1106
#include <bits/stdc++.h>
#define rep(i,j,n) for(register int i=j;i<=n;i++)
#define Rep(i,j,n) for(register int i=j;i>=n;i--)
#define low(x) x&(-x)
using namespace std ;
typedef long long LL ;
const int inf = INT_MAX >> 1 ;
inline LL In() { LL res(0) , f(1) ; register char c ;
#define gc c = getchar()
while(isspace(gc)) ; c == '-' ? f = - 1 , gc : 0 ;
while(res = (res << 1) + (res << 3) + (c & 15) , isdigit(gc)) ;
return res * f ;
#undef gc
}
int n ;
int s1 , s2 , s3 , s4 ;
inline void Ot() {
n = In() ;
rep(i,1,n) {
int x = In() ;
if(x >= 0 and x <= 18) s1 ++ ;
if(x >= 19 and x <=35) s2 ++ ;
if(x >= 36 and x <= 60) s3 ++ ;
if(x >= 61) s4 ++ ;
}
int s (s1 + s2 + s3 + s4) ;
cout << fixed << setprecision(2) << s1* 100.0 / s << '%' << endl ;
cout << fixed << setprecision(2) << s2* 100.0 / s << '%' << endl ;
cout << fixed << setprecision(2) << s3* 100.0 / s << '%' << endl ;
cout << fixed << setprecision(2) << s4* 100.0 / s << '%' << endl ;
}
signed main() {
// freopen("test.in","r",stdin) ;
return Ot() , 0 ;
}
不存在十全十美的文章 如同不存在彻头彻尾的绝望